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
Rickey Champlin142-149-4458Willmschester
Loyal Carroll368-138-6860Lake Cruz
Lawson Rolfson188-397-1912West Zackery
Wendy Parisian991-041-2153East Otis
Elody Gaylord712-392-9156West Claud
Filiberto Reinger350-331-2068West Damien
Jayne Lebsack695-115-2206North Teagan
Austyn Trantow561-213-3172Lake Alysha
Cleora Keeling983-197-0474Evehaven
Brian Beier261-686-9608Lake Chelsie
Aaron Friesen557-665-1324Moenborough
Cheyenne Rippin348-449-1437Wardberg
Gust Mayer634-471-2729Naomichester
Sarai Nikolaus860-519-3051Pearliemouth
Durward Lehner378-006-8685Andrehaven
Destiny Spencer475-666-5202Abbyborough
Gene Lemke679-368-6197Lake Schuylermouth
Taurean Reichel650-187-0065Tyshawnport
Wyatt Gislason175-160-0566Eddiechester
Amanda Walsh691-575-5400East Manuelland
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