We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Overwrite default SfDataGrid filtering behaviour to map to external data provider

Hello,

I'm using the DataGrid control with the built-in filter row and excel-like filter pop-up. The default behaviour here is that filtering is done in-memory. That's great in most cases but I'm now facing a scenario with a list of 200k items which is why I'm using the IncrementalList pattern. 

Because I'm now loading my data from my database as the user scrolls, the in-memory filtering no longer meets the requirements as it now only searches the already loaded data. I would like to map the SF FilterPredicates to my database while maintaining the built-in filter row and popup. However I'm struggling to find the correct way to overwrite this default in-memory filtering behaviour. What's the recommended way of achieving this behaviour?

Kind regards,

Floris

3 Replies

SS Susmitha Sundar Syncfusion Team January 8, 2020 12:24 PM UTC

Hi Floris, 
 
Thank you for using Syncfusion controls. 
 
In Incremental loading, Filter popup shows already loaded data only. This is default behavior of GridFilterControl. You can’t change this behavior by overriding the filter predicates. If you want to load the all data in GridFilterControl, you can use the GridVirtualizationCollectionView instead of Incremental loading. But we have limitations for GridVirtualizationCollectionView, it does not support for DataTable. Please refer the more details from below UG link, 
 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Susmitha S 



FV Floris Verhoeven January 8, 2020 04:28 PM UTC

Hello Susmitha,

Thanks for your reply. I indeed understand that using the Excel-like filter popup is not possible without loading all the data. 

However, I would still like to use the FilterRow without loading all the data. What happens now:
  • Load first 100 records
  • Enter filter text in one of the column
  • SfDataGrid internally filters the currently loaded data set
  • Filtered results based on first 100 records and entered filter text are shown
What I would like to do:
  • Load first 100 records
  • Enter filter text in one of the column
  • Intercept event and get entered filtered text
  • Translate the filter to my external data source
  • Get the new records based on my own query
  • Filtered results based on my own result set, so basically reset the item source of the datagrid
Would that be something that's possible right now?

Kind regards,

Floris


SS Susmitha Sundar Syncfusion Team January 9, 2020 01:50 PM UTC

Hi Floris, 
 
Thank you for your update. 
 
We have checked the incremental loading. In our sample, we have total records count as 100 and we initially loaded the 50 items. If you are using Excel like filtering, you can filter only 50 records. But if you are using FilterRow, you can able to filter the all 100 records. Please check our sample and video link, 
 
 
 
Please check the sample and let us know if you still facing the same issue? If not, please modify the sample based on your scenario and revert us back with your Syncfusion updated version
 
It will be helpful for us to check on it and provide you the solution at the earliest.   
 
Regards, 
Susmitha S 


Loader.
Live Chat Icon For mobile
Up arrow icon