Clearing filters programmatically

2 posts, 0 answers
  1. Peter
    Peter avatar
    27 posts
    Member since:
    Jul 2019

    Posted 02 Aug 2019 Link to this post

    When I try to do the following, the UI Filters are not reset, but the appropriate data is displayed.

    var grid = $("#grid").data("kendoGrid");
    grid.dataSource.filter({});

    I have tried this also: 
    grid.dataSource.filter();

     

    Although not ideal, this works and the UI filters are reset:

    $(".k-i-filter-clear").click();

  2. Nikolay
    Admin
    Nikolay  avatar
    264 posts

    Posted 06 Aug 2019 Link to this post

    Hello Peter,

    The grid.dataSource.filter({}) affects not only the dataSource, but also clears the filter menu forms. For your convenience, I am attaching a simple demo that demonstrates the described approach. Please examine it and let me know if you have any further questions.

    You can also test the above approach by following:
    1. Go to http://demos.telerik.com/kendo-ui/grid/filter-row
    2. Apply some filters to the Grid
    3. Execute the following in the browser's JavaScript console. 
    $("#grid").data("kendoGrid").dataSource.filter({})
    As a result the Grid will rebind and all filtering inputs will be cleared.

    Hope this helps and pelase contact us in case of any questions.

    Regards,
    Nikolay
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top