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
Luis Schulist575-537-3581Cynthiaport
Bianka Feeney626-498-1671Aubreystad
Janis Nienow035-224-2291Camronshire
Antone Connelly784-926-3173New Octavia
Helga Durgan748-695-3782Satterfieldville
Simone Feest339-471-1892Jessiefort
Rafael Howe727-110-5366Gerhardside
Cesar Johnson068-430-0259Paoloburgh
Earlene Goodwin730-688-1971Brownview
Owen Corwin662-413-9369Newtonton
Skylar Cole861-003-6531Yazminport
Casandra Hermann315-931-0879Lamontland
Eleonore Abernathy820-451-3078New Mitchel
Ramiro Fay204-115-5030Port Bell
Reese Murazik046-085-2491Grantstad
Elisabeth Kassulke080-895-6335East Aurelia
Lexus Schuppe748-131-2003South Amyaville
Octavia Harris940-518-5789Kylaborough
Timmothy Dach987-300-5509Hauckfurt
Greyson Kub837-114-3593Gardnermouth
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