This is a migrated thread and some comments may be shown as answers.

Reload Multiselect Filter Box when grid data changes

4 Answers 337 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 29 Oct 2015, 08:00 PM
Using client side paging, we load the data for our grid. The multi-select filter works just fine. Now, we change some parameters and reload the grid but the additional options that should now appear in the filtering do not appear. Is there a way to have the grid reload the multi select filter options after the data is rebound on the grid?

4 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 02 Nov 2015, 10:13 AM

Hello Peter,

 

My suggestion is to define custom DataSource for the multi filter check box and just call its read method in order to reload the data. For example please review the Grid / Filter Multi Checkboxes demo and specifically the second Kendo UI Grid instance. 

 

In order to access the filter multi check box instance 

$("th.k-filterable[data-field='City']").data().kendoFilterMultiCheck.checkSource.read();

 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bryan Patrick
Top achievements
Rank 1
answered on 12 Jul 2018, 12:49 PM

Boyan,

This works well for re-reading the multicheck items.  Too well.  I have 3 multicheck filters and it causes all of them to be re-read from the datasource when I filter the grid even though the user never looks at that column's multicheck filter.

How can I clear the items/reset the filter on the column so that it only hits the transport read when it needs the data (like the first time the user displays the filter)?  I've clearing the items array but that doesn't seem to work.

I just want to set the filter to the initial state so it will re-read when the user displays the multicheck filter.

 

Thank you,

Bryan

(Long time user, first time poster.   :-)  )

 

 

0
Boyan Dimitrov
Telerik team
answered on 16 Jul 2018, 10:21 AM
Hello,

At the time of my last response the filterMenuOpen event was not introduced in the Kendo UI Grid yet. The filterMenuOpen event can be very useful in order to achieve the desired behavior. The event arguments gives you access to the container element. The container element can be used in order to get a reference to the Kendo UI FilterMultiCheck instance and call the read method of the dataSource. Please refer to the code snippet from my response on 2nd of November 2015. 

Regards,
Boyan Dimitrov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Bryan Patrick
Top achievements
Rank 1
answered on 16 Jul 2018, 12:00 PM

That's actually what I ended up doing the next day.  When I filter the grid client side, I just set a flag and then on the filterMenuOpen if the flag is set I use the code you have above to reload the check list (and clear the flag).   You do see the old list briefly before it's reloaded but at least all the new items are there.

I thought filterMenuInit would be the place but that only gets executed once, not every time the filter is displayed.

Thanks for the reply and hope this can help someone else with the same problem.

Tags
Grid
Asked by
Peter
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Bryan Patrick
Top achievements
Rank 1
Share this question
or