This demo illustrates the second scenario. Deferred selection is enabled and the selected rows are only requested when you click the button below the grid.
To enable deferred selection in your application, set the selection.deferred property to true.
To specify the initially selected rows, use the selectionFilter property. The DataGrid updates this property's value at runtime and you can always access the applied filter. In this demo, the selectionFilter selects rows whose Status is Completed.
To load the selected rows' data, call the getSelectedRowsData() method. In deferred selection mode, this method returns a Promise. You can access row data in its fulfillment handler. In this demo, the getSelectedRowsData() method gets data objects that are then used to calculate statistics for the selected tasks.