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 | |
|---|---|---|---|
| Luis Schulist | 575-537-3581 | Cynthiaport | |
| Bianka Feeney | 626-498-1671 | Aubreystad | |
| Janis Nienow | 035-224-2291 | Camronshire | |
| Antone Connelly | 784-926-3173 | New Octavia | |
| Helga Durgan | 748-695-3782 | Satterfieldville | |
| Simone Feest | 339-471-1892 | Jessiefort | |
| Rafael Howe | 727-110-5366 | Gerhardside | |
| Cesar Johnson | 068-430-0259 | Paoloburgh | |
| Earlene Goodwin | 730-688-1971 | Brownview | |
| Owen Corwin | 662-413-9369 | Newtonton | |
| Skylar Cole | 861-003-6531 | Yazminport | |
| Casandra Hermann | 315-931-0879 | Lamontland | |
| Eleonore Abernathy | 820-451-3078 | New Mitchel | |
| Ramiro Fay | 204-115-5030 | Port Bell | |
| Reese Murazik | 046-085-2491 | Grantstad | |
| Elisabeth Kassulke | 080-895-6335 | East Aurelia | |
| Lexus Schuppe | 748-131-2003 | South Amyaville | |
| Octavia Harris | 940-518-5789 | Kylaborough | |
| Timmothy Dach | 987-300-5509 | Hauckfurt | |
| Greyson Kub | 837-114-3593 | Gardnermouth |
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' />