Documentation

Report Edit

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.

NamePhoneCity
Dudley Ward705-928-3543West Elouise
Gino Quigley884-056-9119Gutkowskimouth
Westley Daniel318-075-9365Crystelview
Nayeli McDermott932-477-2617East Allanborough
Ottilie Walker177-323-4041Ericville
Wilber Kshlerin646-074-4815Chaimbury
Deon Hoppe724-520-1950Naomimouth
Alessandra Hessel339-913-5746Kunzeside
Eleonore Jaskolski702-838-3501Lake Harvey
Russ Ortiz066-130-1640Bergnaumview
Esteban Dach330-959-4258New Verla
Casper Smitham024-132-7208East Ericmouth
Garett Bergnaum836-960-9321Faviantown
Elna Lind082-652-6609New Simeonhaven
Arvel Farrell015-810-1133New Willow
Mikel Satterfield104-928-8767South Alitown
Ruthe Hammes764-826-5648Port Elsastad
Randal Wiegand477-841-2263South Javierville
Samara Swaniawski563-303-0629Finnberg
Dandre Bins338-924-9913East Corine
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'
/>
Copied!Cx Fiddle