Query DataGrid with Where instead of Query

I would like to add queries to some of my grids with UrlAdaptors. However, everything I can find has using query, which then you need to extend the datamanager and add a field for every different query item. Is there not a way to take advantage of the where and predicate in the request? I can see it being sent when you do a filter or search.



3 Replies

JC Joseph Christ Nithin Issack Syncfusion Team March 3, 2022 03:23 PM UTC

Hi Eric, 
 
Greetings from Syncfusion support. 
 
Before proceeding further with your requirement, we would like you to provide the following details as we are unclear about your requirement. 
 
  • Do you expect to filter the datasource externally using query?
  • Do you expect to perform initial filtering without using Grid query?
  • Do you want to perform filtering using the query property without using custom binding?
 
If none of the above query matches your requirement, kindly explain your requirement in detail. it will be very helpful for us to validate the reported query further at our end and provide details as early as possible.  
 
Regards, 
Joseph I.  



EP Eric Petersen March 3, 2022 09:53 PM UTC

1) Yes, I would would like to filter the data source externally with some initial filter.

2)  If all gird queries have to have a custom data manager property, then yes.

3) Yes. I know I can append my custom data manager, but then I would have to add a ton of fields in it. Can we not take advantage of the Where property in the data manager?


I would like to perform initial filtering on the grid. I have partial views for different grids that can be populated and I want to be able to pass a parameter to the partial view that will perform an initial filter on the grid. Then if the grid has any other sorts or filters I would like to either keep or re-pass the initial filter along with it.



JC Joseph Christ Nithin Issack Syncfusion Team March 4, 2022 01:21 PM UTC

Hi Eric, 

  Thanks for your update. 

  Based on your query, you want to filter the datasource externally before populating to the grid. Your requirement can be achieved using the `query` property of the grid. Where you can pass the predicates using the where property as ` new ej.data.Query().where(predicate)`. Please refer the below documentation for mode details about the query property. 


Please get back to us for more details. 

Regards, 
Joseph I. 


Loader.
Up arrow icon