Results 1 to 7 of 7

Thread: Filters ignore stateful filters flag on store

    You found a bug! We've classified it as EXTJS-26928 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Sep 2009
    Location
    Denver
    Posts
    63

    Default Filters ignore stateful filters flag on store

    The filters plugin appears to be ignoring the state flag on the store due to hard coded true in the filters init. This is making it not possible to have a stateful grid the excludes the statefulness on store filters. The if (grid.stateful) { store.statefulFilters = true; } appears to trample user specified config.

    ExtJs Version 6.2.167

    located in 'Ext.grid.filters.Filters'

    Code:
    init: function(grid) {
            var me = this,
                store, headerCt;
            Ext.Assert.falsey(me.grid);
            me.grid = grid;
            grid.filters = me;
            if (me.grid.normalGrid) {
                me.isLocked = true;
            }
            grid.clearFilters = me.clearFilters.bind(me);
            store = grid.store;
            headerCt = grid.headerCt;
            me.headerCtListeners = headerCt.on({
                destroyable: true,
                scope: me,
                add: me.onAdd,
                menucreate: me.onMenuCreate
            });
            me.gridListeners = grid.on({
                destroyable: true,
                scope: me,
                reconfigure: me.onReconfigure
            });
            me.bindStore(store);
            if (grid.stateful) {
                store.statefulFilters = true;
            }
            me.initColumns();
        }

  2. #2
    Sencha User
    Join Date
    Sep 2009
    Location
    Denver
    Posts
    63

    Default Possible override

    Code:
    Ext.override(Ext.grid.filters.Filters, {
        init: function (grid) {
            var me = this,
                store, headerCt;
            Ext.Assert.falsey(me.grid);
            me.grid = grid;
            grid.filters = me;
            if (me.grid.normalGrid) {
                me.isLocked = true;
            }
            grid.clearFilters = me.clearFilters.bind(me);
            store = grid.store;
            headerCt = grid.headerCt;
            me.headerCtListeners = headerCt.on({
                destroyable: true,
                scope: me,
                add: me.onAdd,
                menucreate: me.onMenuCreate
            });
            me.gridListeners = grid.on({
                destroyable: true,
                scope: me,
                reconfigure: me.onReconfigure
            });
            me.bindStore(store);
            me.initColumns();
        }
    });
    Sample Store Config Parameters
    Code:
    store: {
        autoDestroy: true,
        statefulFilters: false,
        saveStatefulFilters: false,
        model: primaryStore.model,
        groupers: [],
        data: [],
        proxy: {
            type: 'memory'
        }
    },

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report and override. Can you please post a test case which reproduces the problem?
    https://fiddle.sencha.com/#view/editor

  4. #4
    Sencha User
    Join Date
    Sep 2009
    Location
    Denver
    Posts
    63

    Default

    I created a fiddle to illustrate that the disabling stateful filters on grids is being ignored.

    https://fiddle.sencha.com/#view/editor&fiddle/1s1o

  5. #5
    Sencha Premium Member
    Join Date
    Nov 2012
    Posts
    10

    Default

    +1 we're having this same issue.

    The behaviour is plain wrong, the config just gets blindly overwritten which renders it redundant.

    This issue is still in a state of info required; what additional information is still required on this ticket?

  6. #6
    Sencha User
    Join Date
    Jun 2013
    Posts
    2

    Default

    +1, this bug is still an issue for us.

  7. #7
    Sencha User
    Join Date
    Jan 2016
    Location
    Brazil
    Posts
    141

    Default

    I have reviewed the test case initially provided to work smoothly on ExtJS 6.5.0. Seems Ext.encodeValue() does not work well if some of the object's keys are null, so I just removed it.

    Here's the reviewed fiddle: Filter State Not Disabling.

    Initially, it will not work. The override and variant are commented out in the beginning of app.js. To reproduce the issue then:

    1. click the last column ("Visible") dropdown menu.
    2. click the 'filters' menu entry, so that it filters the column for all the 'false' values. the column title will be bold, underlined and italics.
    3. click the 'Get Grid State' button (third button in grid's top bar)

    The output will display a storeState > filters key.

    Uncomment either one of the blocks in app.js (first block is lines 5-35, second block would be 39-50). They both do basically the same, just one fully overrides and the other relies on callParent().

    Then as you repeat steps 1,2,3 above change also the line 57 either commenting, setting to false (so it uses default value), and setting to true. Depending on line 57:

    - If commented: the default will be the original: if the grid is stateful, then the filters are also stateful (docs says stateful is false by default, but makes sense making true whenever the grid is true, so that's in purpose). So when you click the "Get Grid State" button in step 3 above, the "filters" key will be there.

    - If set to false: the specified value will prevail. Clicking "Get Grid State" on step 3 will not include the "filters" key onthe result.

    - If set to true: the specified value will prevail. Clicking "Get Grid State" on step 3 will include the "filters" key, as if the line was commented out.

    I hope this helps reproducing the issue and applying the fix to the current ExtJS version.
    Object.NET
    Frameworks and Tools for .NET Developers
    --------------------------------------------------
    Ext.NET - Ext JS for ASP.NET - Examples | Twitter
    Bridge.NET - Write C#. Run JavaScript! - Live | Twitter
    --------------------------------------------------

Similar Threads

  1. [INFOREQ] Stateful Components ignore StateEvents
    By anton.stepan in forum Ext 5: Bugs
    Replies: 7
    Last Post: 22 Feb 2018, 3:04 AM
  2. Replies: 0
    Last Post: 2 Jun 2014, 1:23 AM
  3. multiple filters with store.filter
    By dadofgage in forum Ext 3.x: Help & Discussion
    Replies: 8
    Last Post: 7 Oct 2013, 4:37 AM
  4. How to make a DataView ignore it's Store's filter?
    By meej in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 24 Jul 2008, 7:10 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •