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 | |
|---|---|---|---|
| Erica Moore | 364-558-3009 | Port Sigmund | |
| Etha Johnston | 612-948-4655 | Jovanychester | |
| Gregorio Schultz | 242-566-3995 | Lake Zane | |
| Daphne Olson | 085-044-7211 | Paolohaven | |
| Kiel Schoen | 621-498-8385 | Billychester | |
| Lavonne Murazik | 617-778-2677 | Volkmanville | |
| Syble Boehm | 237-975-0443 | Mertzhaven | |
| Adriel Pfannerstill | 133-144-1817 | Romaguerahaven | |
| Skyla Kshlerin | 799-550-1954 | Lake Travon | |
| Seth Runte | 156-156-1238 | Lake Alishaville | |
| Daphne Ward | 361-987-8735 | Keshawnport | |
| Allison Gleason | 574-355-5752 | Charlotteshire | |
| Barbara Brekke | 900-196-8427 | Trystanport | |
| Amber Auer | 255-169-9901 | West Allen | |
| Rocky Kuhlman | 397-869-9811 | North Jamil | |
| Alexzander Goldner | 615-543-7935 | East Zachary | |
| Magnolia Johnston | 319-533-8939 | East Wendellfurt | |
| Alyce Trantow | 627-763-5808 | Emiliabury | |
| Rollin Nikolaus | 995-227-3656 | Lake Abagail | |
| Mabel Ledner | 668-203-4977 | Blaiseborough |
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' />