Problem removing filter

4 posts, 0 answers
  1. Dany
    Dany avatar
    7 posts
    Member since:
    Oct 2015

    Posted 06 Dec 2017 Link to this post

    Hi, I have a problem removing filter when i remove on filter item or all items with "X", my multiselect keep filtering and i don't have all my original datasource data. Here's my definition of my multiselect control :

     

     $("#searchFilter").kendoMultiSelect({
                placeholder: "Catégories de biens et services...",
                filter : "contains",
                dataTextField: "Name",
                dataValueField: "ServiceID",
                height: 400,
                dataSource: {
                    data: @(New HtmlString(Json.Encode(Model.ServicesFilter))),
                    group: { field: "ParentBreadcrumb" },
                    },           
                change: function(){
                    PMEL_SupplierSearch.triggerSearch();
                },




                filtering: function(ev){
                    if(ev.filter) {     
                        var filterValue = ev.filter.value;                    
                        ev.preventDefault();
                        this.dataSource.filter({
                            logic: "or",
                            filters: [
                              {
                                  field: "Name",
                                  operator: "contains",
                                  value: filterValue
                              },
                              {
                                  field: "Keywords",
                                  operator: "contains",
                                  value: filterValue
                              }
                            ]
                        });
                        }                    
                    }
                }


            });

  2. Nencho
    Admin
    Nencho avatar
    1773 posts

    Posted 08 Dec 2017 Link to this post

    Hello Dany,

    Since the filter method accepts an array, you can clear the dataSource filters by passing an empty array, Please consider the below implementation and dojo example:

    var ms = $("#multiselect").data('kendoMultiSelect');
        ms.dataSource.filter([])

    https://dojo.telerik.com/adEpa/7

    Regards,
    Nencho
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Dany
    Dany avatar
    7 posts
    Member since:
    Oct 2015

    Posted 08 Dec 2017 in reply to Nencho Link to this post

    This work well if i remove filter with Remove all (x) but if i have only one filter and remove it with his X, this don't work. Also If i remove filter with bacspace this don't work.
  4. Nencho
    Admin
    Nencho avatar
    1773 posts

    Posted 12 Dec 2017 Link to this post

    Hello Dany,

    In order to have the filters properly cleared, you should clear them as previously demonstrated, on the select event of the MultiSelect. Hence, you will ensure that the filter is nullified each time a selection is performed. IN addition, you can clear it if the filtering event, when the filter.value is empty. 

    In the following dojo example, you can observe implemented the above suggested approach:

    http://dojo.telerik.com/@nenchef/amiFU

    Regards,
    Nencho
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top