Remote data but sort/filter locally?

Hello,

I'm loading data remotely however, some of the columns are computed so I can't sort on them in the API. Is there a way to have sorting/filtering work only on the current page of data, and then only have paging trigger an API call?


Thanks, 


5 Replies

SK Sujith Kumar Rajkumar Syncfusion Team August 4, 2021 12:04 PM UTC

Hi Scott, 
 
Greetings from Syncfusion support. 
 
Based on the query we would like to let you know that when remote data is bound the Grid works on basis of on-demand loading and will only have access to the current page records. However, the Grid actions like, Sort, Filter, etc., need to be performed based on the entire data source. This is its default behavior and it is not feasible to perform the actions with only current page records. We also would like to inform  when remote data is bound to the Grid, all the Grid actions have to be performed on the server side and the Grid updates the view based on the response data received from the server on success. This is the default behavior of remote data adaptors. 
 
So for your case we suggest you to use one of the following approaches, 
 
  • You can set the ‘offline’ property as ‘true’ in the data manager instance. On enabling this property the entire data will be fetched in the initial request itself and all the consecutive actions will be performed in the client-side(considering it as a local data). More details on this can be checked in the below documentation link,
 
 
  • You can use the remote save adaptor which allows you to bind the entire data to the Grid with initial server request on render and all the Grid actions will be performed in client-side except the CRUD actions(for which server request will be sent). More details on the remote save adaptor can be checked in the below help documentation link,  
 
 
  • You can use ajax call to send request to your back end along with the required input values, return back the data to the client, parse the returned data to JSON format and bind it to the Grid’s dataSource property. This will be considered as local data in the Grid. More details on this can be checked in the below documentation link,
 
 
Please get back to us if you require any further assistance. 
 
Regards, 
Sujith R 



SP Scott Price August 4, 2021 12:10 PM UTC

Thanks, I'll review the options



SK Sujith Kumar Rajkumar Syncfusion Team August 5, 2021 06:54 AM UTC

Hi Scott, 
 
You’re welcome. Please get back to us if you require any further assistance. 
 
Regards, 
Sujith R 



AZ Adam Zaghouani February 9, 2022 02:33 PM UTC

Hello,


As I have noticed, nothing works on the grid on the client-side if WebApiAdaptor were to be used.

However, using "Offline: true" as an option isn't a solution either, because I retrieve the data by giving out a query with it. And "Offline" makes the grid ignore the query param addition for some reason.


And isn't it more optimal to do those sort of things ( Sort, Filter, and search ) on the client-side rather the sever's?

Is there really no other solution with WebApiAdaptor? 




SK Sujith Kumar Rajkumar Syncfusion Team February 10, 2022 07:17 AM UTC

Hi Adam, 
 
Greetings from Syncfusion support. 
 
When Web API adaptor is used for binding remote data to the Grid, all the actions need to be handled in the server-side. So it is not feasible to handle some Grid actions alone in the client-side and perform the rest in the server-side. This is the default behavior of this adaptor. 
 
So for your case we suggest you to use one of the solutions we had mentioned in the previous response to achieve your requirement. 
 
Let us know if you have any concerns. 
 
Regards, 
Sujith R 


Loader.
Up arrow icon