update_dt_selection
Updates the selection state of a DataTable (DT) component when a shared ID
is selected or deselected from another linked component. This function handles
both custom click handlers and default selection behavior.
update_dt_selection(component_id, selected_id, session, components)
NULL (invisible). Function is called for side effects only.
Character string. The ID of the DT component to update.
The shared ID value to select. If NULL, deselects all rows.
'shiny' session object for the current user session.
List containing component configuration information, including data reactives, shared ID columns, and optional custom click handlers.
If a custom click handler is provided in the component configuration
(component_info$config$click_handler
), it will be called with
the DT proxy, selected data (or NULL for deselection), and session.
Otherwise, default row selection/deselection is performed.
The function performs the following steps:
Validates that the DT package is available
Retrieves current data from the component's reactive data source
Validates that the shared ID column exists in the data
Creates a DT proxy for programmatic table manipulation
Finds the matching row based on the shared ID
Executes either custom click handler or default selection behavior