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.
Arguments
- component_id
Character string. The ID of the DT component to update.
- selected_id
The shared ID value to select. If NULL, deselects all rows.
- session
Shiny session object for the current user session.
- components
List containing component configuration information, including data reactives, shared ID columns, and optional custom click handlers.
Details
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