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 | |
|---|---|---|---|
| Troy Vandervort | 681-141-2569 | Bobbiefurt | |
| Irma Flatley | 194-695-6329 | Ashtonview | |
| Titus Hane | 466-908-6410 | West Catalina | |
| Gonzalo Krajcik | 550-439-5054 | Alexandriamouth | |
| Mylene Kulas | 534-556-3075 | Roobport | |
| Mossie Cartwright | 153-492-8342 | Port Kolby | |
| Kiarra Wilderman | 384-782-2415 | East Alysa | |
| Dillon Weber | 427-975-3055 | Hartmannchester | |
| Zelma Gerhold | 145-293-9998 | East Lilianehaven | |
| Floy Labadie | 731-903-8866 | New Effie | |
| Kareem Kub | 725-709-2117 | Tonybury | |
| Clovis Paucek | 790-766-7745 | Willytown | |
| Santiago Senger | 614-661-9513 | Port Ardithfort | |
| Dalton Murray | 962-781-8835 | Wellingtonview | |
| Meta Schultz | 864-762-2331 | Lake Lucile | |
| Era Bartoletti | 589-132-6809 | Lake Lamarland | |
| Collin Auer | 230-146-0011 | Maybellefort | |
| Marcelo Bergstrom | 359-753-1136 | Hodkiewiczborough | |
| Joesph Bruen | 282-114-5222 | Hammesstad | |
| Pinkie Bins | 546-670-1111 | Lake Ottis |
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' />