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

[Solved] Replace entire filter control in Kendo Grid

6 Answers 244 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Casper
Top achievements
Rank 1
Casper asked on 11 Nov 2014, 12:03 PM
Hello,
Is it possible to extend the filter control in the grid so that it contains both the two predefined filters and e.g. a DropdownList with a predefined range?
I have figured out how to only show a dropdownlist but we really need the option to do both at the same time.

Alternatively can we replace the filter control entirely? How?

Thanks,
Casper

6 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 13 Nov 2014, 09:29 AM
Hello Casper,

It is possible to use the filterMenuInit event to replace the content but the filter menu supports only two filter inputs. If more inputs are needed in your scenario then you will need to manually apply the filters using the dataSource filter method.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Casper
Top achievements
Rank 1
answered on 13 Nov 2014, 10:36 AM
Thanks Daniel,
We are using the column menu so we can hook into the columnMenuInit event and there have access to the column container.
Your suggestion is in our case to replace the entire content of the filter control and then handle the three inputs in the dataSource filter?

Are there any samples on how we would go about replacing the filtercontrol? And how to build the controls in this event?

Thanks,
Casper
0
Accepted
Daniel
Telerik team
answered on 17 Nov 2014, 10:58 AM
Hello,

You can replace the default filter content by setting the new html for the element with class k-filter-menu:
columnMenuInit: function (e) {
    e.container.find(".k-filter-menu").html(NewFilterHTML);
I am not sure if I understand the question about building the controls, but the needed widgets can be initialized from the elements in the new content as in any other case.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Casper
Top achievements
Rank 1
answered on 21 Nov 2014, 10:00 AM
Sorry for picking this up again Daniel.

My question regarding the new controls is related to how I initialize them and hook them up to the filtervalues and actions - i.e. how to trigger the filter action when clicking the Filter button?

Thanks,
Casper
0
Accepted
Daniel
Telerik team
answered on 25 Nov 2014, 08:43 AM
Hello Casper,

To trigger the filter action you should use the dataSource filter method. I would suggest to check this example in the documentation. The scenario is not exactly the same but it demonstrates how to clear the current filters for the field and set the new ones with the filter method when the button is clicked.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Casper
Top achievements
Rank 1
answered on 27 Nov 2014, 10:19 AM
Thanks,
Exactly what I was looking for :-)

/Casper
Tags
Grid
Asked by
Casper
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Casper
Top achievements
Rank 1
Share this question
or