The Grid enables the user to select single or multiple cells and rows. It also provides default selection implementation from the
getSelectedState utility function.
The Grid selection can be enabled by:
- Set the
- Set the
- Use the
- Optionally use the
getSelectedStateutility function for default selection behavior.
As a result, the Grid allows you to:
- Select single cell or row
- Select multiple cells or rows
- Select range of cells or rows by dragging
selectedField option represents a field inside the data collection which determines the rows that will render as selected.
The Grid enables you to select single or multiple cells or rows and calculate different metrics based on the selected data.
This functionality allows you to get a quick snapshot of some of the more important aggregates of the selected data. You can use the built-in approach and display these metrics at the bottom of the Grid or create your own elements that would display the data.
The Grid supports the following built-in aggregates for all selected cells:
max—the greatest number. Valid for numeric fields.
min—the smallest number. Valid for numeric fields.
sum—the sum of all numbers. Valid for numeric fields.
average—the average of all numbers. Valid for numeric fields.
count—the total number of cells.
earliest—the earliest date. Valid for
latest—the latest date. Valid for
isTrue—the total number of boolean fields with
isFalse—the total number of boolean fields with
The Grid provides both checkbox and row-click selection options which can be applied to single or multiple records.
The checkbox selection enables selection upon a checkbox click and implements a master checkbox in the header that selects and deselects all items.
To configure the checkbox selection:
- Set a selection column by setting the
fieldoption and passing the
- Handle the
onHeaderSelectionChangeevents which will be fired once the user clicks a checkbox.
- Depending on the selected state of an item, set the
The following example demonstrates how to implement multiple selection both on row click and with checkboxes.