In order to enable records selection, you’ll have to add the following properties to the
DataTable
:
selectedRecords
→ an array of currently selected records (with the same TS type as the records
property);onSelectedRecordsChange
→ a callback that will be invoked when the user alters the current selection.
When adding these two properties, the component will render a selection checkbox column and handle user input as following:
- Clicking a row selection checkbox will result in selecting/deselecting the underlying record;
- Clicking the column header checkbox will result in selecting/deselecting all visible records;
- Shift-clicking a row selection checkbox will result in intuitively selecting all records between the last clicked record and the current one.
You can disable the selection of certain records by providing an `isRecordSelectable` property like so: