Multi-Select's data source not filtering

2 posts, 0 answers
  1. Brian Vallelunga
    Brian Vallelunga avatar
    88 posts
    Member since:
    May 2008

    Posted 07 Mar 2014 Link to this post

    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?
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 11 Mar 2014 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
Back to Top