Hi Peter,
Thanks for contacting Syncfusion support.
Query 1: Is there some kind of EventCallback somewhere I can hook into to make the API request when the grid needs it?
We suggest you to use the Custom Adaptor feature of our DataManager component which is suitable to achieve your requirement. Please refer to the below documentation for more details.
The custom adaptor can be provided to the grid`s data manager either as class instance or Blazor component. We suggest you to use custom adaptor as individual component since it supports dependency injection and other benefits. Please refer to the below documentation.
Here the ReadAsync method of CustomAdaptor will be invoked every time when grid needs data. And the ReadAsync method will be passed with DataManagerRequest class instance which will hold the information about data needed (similar to the mentioned EventSearchQuery in your case), you can get the requested details for the paging, sorting, filtering actions from this DataManagerRequest class.
The DataManagerRequest.Skip and DataManagerRequest.Take will hold the current range of data needed by Grid component.
Query 2: How do I get the ordering information?
The DataManagerRequest.Sorted property will hold the current sorted columns information.
Query 3: How do I get the values the user typed into the column filters?
The DataManagerRequest.Where property will hold the current filtered columns information.
Query 4 : How do I tell the grid there are 1_000_000 results even though the server only returns a single page of 10 items?
When Grid requires total records count from the data source then the DataManagerRequest.RequiresCount property will be set as true. If the RequiresCount is true then return data from the ReadAsync method should be object with properties Result to hold the current view data and Count to hold the total records count.
The code example that shows the usage of RequiresCount is as follows.
public override object ReadAsync(DataManagerRequest dm, string key = null)
{
.....
return dm.RequiresCounts ? new DataResult() { Result = DataSource, Count = count } : (object)DataSource;
}
|
You could also refer to our online demo which shows the usage of custom binding feature in grid including handling CRUD operations.
Please get back to us if you need further assistance.
Regards,
Madhu Sudhanan P