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 | |
|---|---|---|---|
| Dudley Ward | 705-928-3543 | West Elouise | |
| Gino Quigley | 884-056-9119 | Gutkowskimouth | |
| Westley Daniel | 318-075-9365 | Crystelview | |
| Nayeli McDermott | 932-477-2617 | East Allanborough | |
| Ottilie Walker | 177-323-4041 | Ericville | |
| Wilber Kshlerin | 646-074-4815 | Chaimbury | |
| Deon Hoppe | 724-520-1950 | Naomimouth | |
| Alessandra Hessel | 339-913-5746 | Kunzeside | |
| Eleonore Jaskolski | 702-838-3501 | Lake Harvey | |
| Russ Ortiz | 066-130-1640 | Bergnaumview | |
| Esteban Dach | 330-959-4258 | New Verla | |
| Casper Smitham | 024-132-7208 | East Ericmouth | |
| Garett Bergnaum | 836-960-9321 | Faviantown | |
| Elna Lind | 082-652-6609 | New Simeonhaven | |
| Arvel Farrell | 015-810-1133 | New Willow | |
| Mikel Satterfield | 104-928-8767 | South Alitown | |
| Ruthe Hammes | 764-826-5648 | Port Elsastad | |
| Randal Wiegand | 477-841-2263 | South Javierville | |
| Samara Swaniawski | 563-303-0629 | Finnberg | |
| Dandre Bins | 338-924-9913 | East Corine |
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' />