web-client-ui
web-client-ui copied to clipboard
Keyed Selection
This is in reference to Deephaven Enterprise ticket DH-9378.
Currently, we maintain and operate on selection as an array of GridRange. For tables with key columns, we should implement keyed selection.
Keyed selection means:
- If a row is selected, then all rows with same keys are considered selected (note that some tables have unique keys but others allow duplicates).
- If a table changes (sort, filter, rows updated) then selection is maintained on keys rather than row numbers.
- Operating on a selection (Copy, Export, etc...) will operate on all rows for selected keys
Some thoughts on implementation:
- I think IrisGrid is the correct place to implement this as Grid has no knowledge of keys.
- We will need to keep a set of selected keys client side (most likely key hashes to save memory).
- For cases where the user selects more than half the table, we can invert the selection (we do this for other selections)
- We could add a hidden column (like our format columns) with the key hash so the UI does not need to compute it
There are two ways to implement:
- Update Selection on Table Changed
- On user selects rows, store keys for selected rows. If the selection is out of viewport, request keys from server.
- When the table updates (sort, filter, row update):
- show loading spinner on table (or maintain it if already shown)
- Request updated GridRange selection for keys from server
- Render selection as normal
- Operate on selection as normal
- Update Selection when Selection is Used
- On user selects rows, store keys for selected rows. If the selection is out of viewport, request keys from server.
- If getting keys from the server, disable operations that use selection until the keys are returned.
- On render, check if a row's key is in the set of selected keys and render it as selected.
- When the user operates on selection (Copy, Export, etc...):
- request updated GridRange selection for keys from server
- operate on the updated selection
- Alternatively, we could update the API to operate on selected keys