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

Multi-Select's data source not filtering

1 Answer 100 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Brian Vallelunga
Top achievements
Rank 1
Brian Vallelunga asked on 07 Mar 2014, 03:43 PM
I have a multi select that is configured like this:

var config = {
    dataTextField: "Name",
    dataValueField: "Id",
    dataSource: new kendo.data.DataSource({
        transport: {
            read: {
                url: "/api/terms"
            }
        },
        filter: { field: "Name", operator: "neq", value: "Default" }
    })
};

For some reason the filter is not applied and "Default" is always shown as an option in the multi-select. Everything binds correctly otherwise. Am I missing something?

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 11 Mar 2014, 09:20 AM
Hello Brian,

The MultiSelect widget persists all filters, which have different field value from the dataTextField option. Default filters, which filtrate the data on the same field as the dataTextField is not supported, because the widget creates and remove filters for the same field dynamically.
If you need to remove data then I would suggest you wire the change event and remove all unnecessary data items:
dataSource: new kendo.data.DataSource({
        transport: {
            read: {
                url: "/api/terms"
            }
        },
        change: function(e) {
             if (e.action !== "remove") {
                  var data = this.data();
 
                  //remove data
                  this.remove(data[0]);
             }
        }
    })

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
MultiSelect
Asked by
Brian Vallelunga
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or