selection

Configures runtime selection.

Type: Object

A user can select rows in a single or multiple mode. In multiple mode, a user can select all rows at once. To disable this feature, assign false to the allowSelectAll.

By default, once a user selects a row, the data source is instantly notified about it. This may lower the widget performance if the data source is remote and the user is allowed to select all rows at once. In this case, we recommend making the selection deferred.

View Demo

See Also

allowSelectAll

Specifies whether a user can select all rows at once.

Type: Boolean
Default Value: true

To select all rows at once, a user presses Ctrl + A or clicks the check box located in the header of the selection column. If you set this option to false, the shortcut and the check box will not select all rows. However, the check box will still clear selection.

Show Example:
AngularJS
Knockout
jQuery

In this example, you can change the value of the selection | allowSelectAll option by toggling the check box under the grid. When this option is true, you can select all grid records at once using the check box in the header of the selection column. When the aforementioned option is false, this check box can be used only to deselect all records.


                                    

                                    

In this example, you can change the value of the selection | allowSelectAll option by toggling the check box under the grid. When this option is true, you can select all grid records at once using the check box in the header of the selection column. When the aforementioned option is false, this check box can be used only to deselect all records.


                                    

                                    

In this example, you can change the value of the selection | allowSelectAll option by toggling the check box under the grid. When this option is true, you can select all grid records at once using the check box in the header of the selection column. When the aforementioned option is false, this check box can be used only to deselect all records.


                                    

                                    

deferred

Makes selection deferred.

Type: Boolean
Default Value: false

Consider making selection deferred if the widget needs to operate a large volume of data and the user is allowed to select all rows at once. Unlike usual (or "instant") selection, in the case of deferred selection, the widget requests data only when you demand this using the API, for example, when the getSelectedRowsData() or getSelectedRowKeys() method is called. This mode has certain specifics that determine the API you need to use. For more information, see the Deferred Selection article.

NOTE
Deferred selection is unsupported when selectAllMode is 'page'.

View Demo

mode

Specifies the selection mode.

Type: String
Default Value: 'none'
Accepted Values: 'none' | 'single' | 'multiple'

The following selection modes are available in the widget:

  • Single
    Only one row can be in the selected state at a time.

  • Multiple
    Several rows can be in the selected state at a time.

When using the widget as an ASP.NET MVC Control, specify this option using the SelectionMode enum. This enum accepts the following values: None, Single and Multiple.

Show Example:
AngularJS
Knockout
jQuery

In this example, you can spot the difference between the selection modes provided by the DataGrid widget. Choose a required mode using the select box under the grid, and then click one or several grid records. Data for this example is obtained from www.odata.org.


                                    

                                    

In this example, you can spot the difference between the selection modes provided by the DataGrid widget. Choose a required mode using the select box under the grid, and then click one or several grid records. Data for this example is obtained from www.odata.org.


                                    

                                    

In this example, you can spot the difference between the selection modes provided by the DataGrid widget. Choose a required mode using the select box under the grid, and then click one or several grid records. Data for this example is obtained from www.odata.org.


                                    

                                    

selectAllMode

Specifies the mode in which all the records are selected. Applies only if selection | allowSelectAll is true.

Type: String
Default Value: 'allPages'
Accepted Values: 'page' | 'allPages'

selectAllMode specifies how records should be selected on clicking the "Select All" check box and by calling the selectAll()/deselectAll() methods. The following modes are available.

  • 'page'
    Selects records on currently rendered pages.

    NOTE
    This mode is incompatible with deferred selection.
  • 'allPages'
    Selects records on all pages.

When using the widget as an ASP.NET MVC Control, specify this option using the SelectAllMode enum. This enum accepts the following values: Page and AllPages.

View Demo

showCheckBoxesMode

Specifies when to display checkboxes in rows. Applies only if selection | mode is "multiple".

Type: String
Default Value: 'onClick'
Accepted Values: 'onClick' | 'onLongTap' | 'always' | 'none'

When using the widget as an ASP.NET MVC Control, specify this option using the GridSelectionShowCheckBoxesMode enum. This enum accepts the following values: OnClick, OnLongTap, Always and None.

Show Example:
AngularJS
Knockout
jQuery

In this example, you can spot the difference between the checkbox row display policies provided by the DataGrid widget. Choose the required policy using the select box under the grid, and then click one or several grid records. Data for this example is obtained from www.odata.org.


                                    

                                    

In this example, you can spot the difference between the checkbox row display policies provided by the DataGrid widget. Choose the required policy using the select box under the grid, and then click one or several grid records. Data for this example is obtained from www.odata.org.


                                    

                                    

In this example, you can spot the difference between the checkbox row display policies provided by the DataGrid widget. Choose the required policy using the select box under the grid, and then click one or several grid records. Data for this example is obtained from www.odata.org.