Possible solution is to get all available data in the dataSource of the grid through the data
method. Then get only the ids of the available date items. The following code block illustrates how to achieve the aforementioned approach:
ids = $(
// all identifiers are available in the ids array
Also I noticed that the grid is configured to use ajax request to fetch data but also a model is passed to its constructor. It is recommended to use either Server- or Ajax binding since mixing them can lead to unexpected behavior.
The following demo illustrates grid configured to use ajax binding:
And the below demo demonstrates server binding: