How to refresh custom filter options in kendo grid ?

1 Answer 97 Views
Filter Grid
Edvin
Top achievements
Rank 1
Iron
Edvin asked on 23 Nov 2021, 03:23 PM | edited on 23 Nov 2021, 03:59 PM

Hello, 

I have a kendo grid, with custom filter in some columns defined like this:

c = columns.Bound(x => x.Field1).Title("Field1").Width(130).Filterable(filterable => filterable.Extra(false).UI("customField1Filter").Operators(op => op.ForString(str => str.Clear().IsEqualTo("Is equal to"))));

and

function customField1Filter(element) {
        element.kendoDropDownList({
            dataTextField: "Text",
            dataValueField: "Value",
            dataSource: {
                transport:{
                    read: {
                        data: getdata(),
                        url: "@Url.Action("PopulateField1Filter", "Common")"
                    }
                }
            },
            optionLabel: "--Select Value--"
        });
    }

 

It works fine, but in order to implement a complex cascading filtering betweent a lot of columns, I have to refresh the options of them.

For exemple: columns 1 display country, columns 2 display city, both are filterable. When I select a country on first filter, i have to refresh the options of the city filter.

How to programmacally refresh filter option of a specific column ? Or refresh filters of all columns witout refresh grid data ?

Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Accepted
Edvin
Top achievements
Rank 1
Iron
answered on 23 Nov 2021, 05:48 PM

I found solution:

- add $(element).attr('id', "field1DropDownFilter"); on customField1Filter function

- $("#field1DropDownFilter").data("kendoDropDownList").dataSource.read()

Tags
Filter Grid
Asked by
Edvin
Top achievements
Rank 1
Iron
Answers by
Edvin
Top achievements
Rank 1
Iron
Share this question
or