filterkendo-uitelerikdropdownkendo-dropdown

Kendo dropdownlist custom filter


I want to filter dropdownlist data on multiple columns. Currenly it filter data based on one column.

Is there any custom way to filter data based on multiple columns?

Code :

$('<input data-bind="value:' + options.field + '"/>')
                        .appendTo(container)
                        .kendoDropDownList({
                         filter: "contains",

                        dataTextField:currentComboEditor.fieldName,
                        headerTemplate: dropdownTemplateHTML.getHeaderHTML(dropdownMetadata.columns),
                        valueTemplate: '<span>#:data.'+currentComboEditor.fieldName+'#</span>',
                        template: dropdownTemplateHTML.getRowTemplate(dropdownMetadata.columns),
                        dataValueField: currentComboEditor.fieldName,
                        dataSource: {
                            data: source
                        } 
                        });

Solution

  • There's no built-in way to filter a kendoDropDownList on multiple column. The only way you could do this would be by creating your own filter:

    var filterValue = "search me";
    var newFilter = {
        logic: "or",
        filters: [
            { field: "FieldA", operator: "contains", value: filterValue },
            { field: "FieldB", operator: "contains", value: filterValue },
            { field: "FieldC", operator: "contains", value: filterValue }
       ]
    };
    kendoDropDownList.dataSource.filter(newFilter);
    

    Depending on your needs, you'll have to hook this code on the right events.