Grid with Multiple Selection
Grid supports multiple selection. Single select is the default. For additional rows use Ctrl key
or checkboxes.
To select all rows click the checkbox in the header.
Example also showcases use of onTrackMappedRecords in combination with onCreateFilter callback.
Using onTrackMappedRecords we can access filtered records.
| Name | Phone | City | |
|---|---|---|---|
| Rickey Champlin | 142-149-4458 | Willmschester | |
| Loyal Carroll | 368-138-6860 | Lake Cruz | |
| Lawson Rolfson | 188-397-1912 | West Zackery | |
| Wendy Parisian | 991-041-2153 | East Otis | |
| Elody Gaylord | 712-392-9156 | West Claud | |
| Filiberto Reinger | 350-331-2068 | West Damien | |
| Jayne Lebsack | 695-115-2206 | North Teagan | |
| Austyn Trantow | 561-213-3172 | Lake Alysha | |
| Cleora Keeling | 983-197-0474 | Evehaven | |
| Brian Beier | 261-686-9608 | Lake Chelsie | |
| Aaron Friesen | 557-665-1324 | Moenborough | |
| Cheyenne Rippin | 348-449-1437 | Wardberg | |
| Gust Mayer | 634-471-2729 | Naomichester | |
| Sarai Nikolaus | 860-519-3051 | Pearliemouth | |
| Durward Lehner | 378-006-8685 | Andrehaven | |
| Destiny Spencer | 475-666-5202 | Abbyborough | |
| Gene Lemke | 679-368-6197 | Lake Schuylermouth | |
| Taurean Reichel | 650-187-0065 | Tyshawnport | |
| Wyatt Gislason | 175-160-0566 | Eddiechester | |
| Amanda Walsh | 691-575-5400 | East Manuelland |
See also:
ControllerIndex
<Grid records-bind='$page.records' tyle={{width: "100%"}} columns={[{ header: {items: <cx><Checkbox value-bind="$page.selectAll" indeterminate unfocusable/></cx>}, field: 'selected', style: 'width: 1px', items: <cx><Checkbox value-bind="$record.selected" unfocusable/></cx> }, {header: 'Name', field: 'fullName', sortable: true}, {header: 'Phone', field: 'phone'}, {header: 'City', field: 'city', sortable: true} ]} selection={{type: PropertySelection, bind: "$page.selection", multiple: true}} sorters-bind="$page.sorters" filterParams-bind='$page.searchText' onCreateFilter={(searchText) => { if (!searchText) return () => true; let predicate = getSearchQueryPredicate(searchText); return record => predicate(record.fullName) || predicate(record.phone) || predicate(record.city); }} onTrackMappedRecords='updateSelection' />