DataGrid has the following API for multiple record selection:
selectAll() / deselectAll()
Selects / deselects all rows or current page rows, depending on the value of selectAllMode.
selectRows(keys, preserve) / deselectRows(keys)
Selects / deselects rows with the specified keys.
selectRowsByIndexes(indexes)
Selects rows with specific indexes.
clearSelection()
Clears the selection of all rows on all pages.
getSelectedRowKeys() / getSelectedRowsData()
Gets the selected rows' keys or data objects.
In this demo, selectAll() or selectRows(keys, preserve) is called when you change the SelectBox value and clearSelection() is called when you click the Clear Selection button.