Grid Filters do not reload when filters values reset to defaults

7 posts, 0 answers
  1. Graeme
    Graeme avatar
    5 posts
    Member since:
    Jan 2013

    Posted 04 Apr 2013 Link to this post

    if you set a column filter value and then click filter in the Grid Column Filter Pop, the grid will filter.

    If you then manually set the filtered value back to Nothing ("") by deleting the value in the text box and click filter, nothing will happen, and the grid will still be filtered on the previous value. The expected behaviour woudl be for the Grid to be reloaded with no filters when none are specified and the filter button is clicked.

    This is mildly inconsistent when using the standard grid filter functionality, and very broken if you are customising the grid filters yourselves and using dropdowns or multiselects as I am.

    In order to fix this behaviour,  the following simple change neds to be made to the filter method of the  FilterMenu object in the lastest source.

     
    var FilterMenu = Widget.extend(
    .
    .
    .
     filter: function(expression) {
                expression = this._merge(expression);
                if (expression.filters.length) {
                    this.dataSource.filter(expression); 
                } else {                               // Add these lines
                    this.dataSource.read();          // Add these lines
                }                                      // Add these lines
            },

    Any chance this fix or similar could be incorporated into a future build ?
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 05 Apr 2013 Link to this post

    Hi Graeme,


    The default behavior by design is to not perform any action when the filter input field is empty, so the last applied filter remains active. If you want to clear the filters and get the non-filtered data, you could use the "Clear" button. To do it programmatically, you could use the following snippet.
    E.g.
    var grid = $("#Grid").data("kendoGrid");
    grid.dataSource.filter({});

     

    All the best,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Graeme
    Graeme avatar
    5 posts
    Member since:
    Jan 2013

    Posted 17 Apr 2013 Link to this post

    I realise this is the default behaviour. My point is that the default behaviour is not correct.

    if a Grid is filtered, using the column filter menu, and then that filter menu item is cleared manually and filter is clicked again (as opposed to using the clear button), then the Grid will not releoad and will still be filtered on the original value even though if you inspect the filter menu visually, or query the datasource filters programmatically, there are no filters.

  4. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 17 Apr 2013 Link to this post

    Hi Graeme,


    If you consider that the implementation of the filters should be changed, please post your suggestion to the Kendo User Voice portal. If it receives enough votes from the community, we will consider to implement it in future releases of Kendo UI.

     

    Greetings,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Aliaksandr
    Aliaksandr avatar
    1 posts
    Member since:
    Aug 2013

    Posted 27 Sep 2013 Link to this post

    Graeme is actually right. The default behavior is inconsistent and needs to be fixed. 

    For those who like me wants to customize filter menu and have it functioning properly, you have two options. You can hack source code using Graeme patch above. Or you can hook FilterMenu prototype and overwrite it (with above fix):
    kendo.ui.FilterMenu.prototype.filter = function() {
        // expression = this._merge(expression);
        if (expression.filters.length) {
            this.dataSource.filter(expression);
        } else {
            this.dataSource.filter({});
        }
    }


  6. Anna
    Anna avatar
    64 posts
    Member since:
    Jul 2015

    Posted 02 May 2016 Link to this post

    Any new on this issue? I do agree with Graeme and Aliaksandr the filter behavior is inconsistent and broken. It should act at least one of the ways below when filter input box is empty

    1. Click "Filter" will reset the filter (function same as Clear Filter button)

    2. "Filter" button is disabled when there is no input

    3. Click "Filter" will do nothing, but the filter menu will stay open and have error indicator to let user know nothing isn't a valid filter criteria. At very least, if user open the filter menu again, the filter input box should keep the last valid search expression.

     

  7. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 03 May 2016 Link to this post

    Hello Ama,

    As stated previously, the current behavior is by design. If you consider that we should improve it, please post the suggestion in our Feedback portal.

    Regards,
    Dimiter Madjarov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top