Has anyone used a button to select all the rows in a table? I see that someone has asked this in 2019, but there was no answer.
Doesnt really seem to be possible i think.
What would you want to do when you select everything?
This feature will be very usefull !
We continued to run into this issue, and I'm glad to see there's a feature request open to add this in.
Until that feature gets added, and since this is the main thread that comes up for this request, I want to share a general overview of how we solved this for a control scheme (with some great advice from @pturmel off the forum). I hope this can help someone with a similar need.
-
Use two tables, a display table and a selections table. Only one will display at a time.
-
From a UX perspective, we flip the construct so that the default behavior is "everything selected," and selecting items creates a filtered selection on the selections table. Since there's no good way to select all but we'd never have a case where someone needs to command none, we simply treat none as all and anything more than none as a filtered selection.
-
The selections table's columns prop is bound to the display table's columns props so they stay in sync. Both tables bind to lists of tagPaths in custom properties and remap them identically through Integration Toolkit expressions. But the source argument in the
forEach()
expression is either the source tag list or the selection tag list. -
A command mode toggle switches the display prop to display only the full table or the selections table, and also swaps some aggregations for the batch controls.
-
Display table's
onRowDoubleClick
event wipes out the selection via:
if self.props.selection.selectedRow >= 0:
self.props.selection.enableRowSelection = False
- Display table's
props.selection.selectedColumn
has a change script to re-enable selection:
if currentValue.value is None:
self.props.selection.enableRowSelection = True