-
Notifications
You must be signed in to change notification settings - Fork 162
Row Selection (Grid feature)
Version | User | Date | Notes |
---|---|---|---|
0.1 | Nikolay Alipiev | March 22, 2018 | Initial Draft |
The igx-grid
should support selection of one or more rows.
The igx-grid
should support selection of one or more rows, through a checkbox that is preceding all other columns in the row. Clicking the checkbox will select/deselect the row, and selection will not happen when clicking any other cell in the row. Checkbox column will be fixed, which will leave it visible, even a horizontal scrollbar is presented.
- to select/deselect grid rows, using a checkbox
- to select/deselect checkbox, using space key
- the checkbox column to be always the first column
- the checkbox column to be always visible
- to have checkbox in header that will select/deselect all visible rows
- preserver selection, even the selected rows are out of visual scope
- get/set selected rows collection
- select/deselect all rows
- be notified, when selection has changed
- be able to cancel selection that is in progress
3.1. End User Experience
Users are able to select and deselect row, using a checkbox, that is pinned at the start of the row.
3.2. Developer Experience
Enabling the row selection behavior in the grid is as easy as:
<igx-grid #grid [data]="localData" [selectable]="true"></igx-grid>
Developers are able to programmatically select/deselect rows. The identification of the rows, happen according the the grid primaryKey.
Selection of rows is as easy as:
this.grid.select([row1,row3,row5]);
Developers can also subscribe to an event emitted before the row selection is copmleted:
<igx-grid #grid [data]="localData" [selectable]="true" (onRowSelection)="rowSelection($event)"></igx-grid>
public rowSelection(event) {
const grid = event.row.grid;
grid.deselectAll();
grid.select([event.row]);
}
3.3. Keyboard Interaction
As far as the default way to select a row is using, the checkbox, then focusing the checkbox and using the Space, will toggle the selection.
3.4 API
-
IgxGridComponent
Name Description Type selectable Enable row selection for the grid boolean
-
IgxGridComponent
Name Description Return type Parameters getSelection Get current selection state Array<IgxRowComponent>
- array with selected rowsselect Select specified rows bool
- whether the select was successful or notArray<IgxRowComponent>
, clearCurrentSelection:boolean
deselect Deselect specified rows bool
- whether the deselect is successful or notArray<IgxRowComponent>
selectAll Select all rows bool
- whether the select is successful or notdeselectAll Select all rows bool
- whether the deselect is successful or not -
IgxGridRowComponent
Name Description Return type Parameters isSelected bool
- whether the row is selected or notselect Select this row bool
- whether the select is successful or notdeselect Deselect this row bool
- whether the deselect is successful or not
Name | Description | Cancelable | Parameters |
---|---|---|---|
onRowSelection | Emitted when selection is changed, before the selection completes. | true | row: IgxGridRowComponent , selection: Array<IgxRowComponent>
|
Add aria attribute for the selected row.
Following the Material Design Guidelines the following setting where omitted, to allow easy configuration of the feature. All the below can be achieved, using the row selection API.
- the only mode of selection will be multiple
- the only way to select row, will be through the checkbox.
- checkbox will be always rendered (along with the header one)