Custom GridFilterCell ComboBox with remote data

1 Answer 54 Views
Filter  Grid
Kyle Smith
Top achievements
Rank 1
Kyle Smith asked on 24 Feb 2023, 05:11 PM

Let's say we have a grid displaying orders: Order ID, Customer Name, Product Name. The grid is displaying the "ProductName" but filtering needs to be done by "ProductID". If we have thousands of products, we don't want to populate the combobox with everything, but instead might want to use remote data (filtering/virtualization). Most examples I find assume there is local data in some json file. How can we implement a custom grid filter cell that has a combobox that uses remote data?

My understanding is that the filter row is stateless and controlled by the grid. If I implement a custom combobox with remote data as soon as I filter the grid via the GridFilterCellProps onChange, the filter cell state is lost (so no more loaded data matching the selected item) and appears that nothing is selected even though a filter is applied.

I've tried to store the state outside of the filter cell, but I can't seem to get it right. Anyone else have any luck doing something like this?

1 Answer, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 27 Feb 2023, 12:47 PM

Hello Kyle,

Thank you for reaching out to us.

With the custom filter cell you need to ensure that you are setting the current filter value to the filter component correctly, so that it can keep its selected state. I have prepared a simple example with a custom filter cell containing a ComboBox with filtering and virtual scrolling with remote data:

You will notice that the selected value is kept in the filter component correctly.

If further assistance is needed, please share a stackblitz example demonstrating the issue that you are facing, so we can test and debug it locally.

 

Regards,
Konstantin Dikov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Kyle Smith
Top achievements
Rank 1
commented on 27 Feb 2023, 07:28 PM

Thank you. This example helped me get the filter combo box working. I think my main issue was trying to use the "WithValueField" version from the demos where it returns the value field only rather than the entire data item. I was doing this because the grid's datasource ultimately expects the filter to be the ID value (e.g, CustomerID in your example). I can revise my grid datasource to accommodate the change in filter value.
Tags
Filter  Grid
Asked by
Kyle Smith
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or