3
votes

there is a feature called "Filter Row" in Kendo Grid

http://demos.telerik.com/kendo-ui/grid/filter-row

I want to add a drop-down list instead of a text box or a number box, to the filter box. It's for filtering a column that has countries. So I want list of countries in a drop-down list. How can I do this?

2
I'm trying to do this as well. So far I've gotten to the point where I have my filter drop down but it's resetting to 0 after selecting a value and the filter request sent to the ajax request is empty. - Pluc

2 Answers

7
votes

It's very similar to the custom Filter Menu (http://demos.telerik.com/kendo-ui/grid/filter-menu-customization). I made the mistake of no using valuePrimitive: true. You might not want it in your situation but keep that in mind.

Here's a sample: http://dojo.telerik.com/OKaS

Also, the filter menu should take up the editor model of the column but it's not always what you want.

Edit

Starting from 2014 Q2 SP1, the template function now receives an object containing "datasource" and "element". In my example, you would have to change the dropdown initialization from "container.kendoDropDownList" to "container.element.kendoDropDownList". The datasource is empty in my example but I'm assuming this can be used to pass the choices to a control without requiring another datasource or to externalize your current. I have not experimented with this feature but I suggest you do before taking my sample blindly.

0
votes

As Pluc mentioned earlier valuePrimitive: true will help you create a custom filter for your grid/columns to send id's to your controller, if you are not using setting this property true you will receive an Object in your controller instead of a number, the conversion will not be made automatically . This is still working as of 2019