View Full Version : [4.0.6] Grid filters (from ux) don't get persisted in a stateful component

20 Sep 2011, 12:43 AM
REQUIRED INFORMATION Ext version tested:

Ext 4.0.6

Browser versions tested against:

Google Chrome 13.0.782.220

DOCTYPE tested against:

4.01 strict


When using a stateful grid with filters feature (Ext.ux.grid.FiltersFeature), column settings get persisted correctly, but filters are not, despite the claim in the documentation. For example, if you rearrange the columns or hide some of them, and then reload the page, the columns are again in the order you left them. However, any filters you previously applied are lost.

Steps to reproduce the problem:

Use the following code in a browser that supports HTML 5 local storage (e.g. recent Chrome)
Move column Y before X; apply some filter on any of the columns
Reload the page

The result that was expected:

Column Y is before X
Filters are as applied before

The result that occurs instead:

Column Y is before X, i.e. statefulness in general works
Filters are lost

Test Case:
Ext.Loader.setConfig ({ enabled: true });
Ext.Loader.setPath ('Ext.ux', '../ux');
Ext.require (['Ext.ux.grid.FiltersFeature']);

Ext.define ('LoggingStateProvider',
extend: 'Ext.state.LocalStorageProvider',

get: function (name)
console.log ('get', name, this.callParent (arguments));
return this.callParent (arguments);

set: function (name, value)
console.log ('set', name, value);
this.callParent (arguments);

Ext.onReady (function () {
Ext.state.Manager.setProvider (new LoggingStateProvider ());
var grid = Ext.widget ('gridpanel',
{ renderTo: document.body,
store: { type: 'array',
fields: [{ name: 'x',
type: 'number' },
{ name: 'y',
type: 'number' }],
data: [[0, 1], [2, 3], [4, 5]] },
columns: [{ header: 'X',
dataIndex: 'x',
filterable: true },
{ header: 'Y',
dataIndex: 'y',
filterable: true }],
features: [{ ftype: 'filters',
local: true }],
height: 300,
stateId: 'test' });
HELPFUL INFORMATION Console log output:

Note that the custom statefulness provider logs its calls to console. After reloading the page, it logs a get followed by a set. The get operation does return the filters, but in the subsequent set parameter filters are already gone. This might mean that by the point persisted state is applied, filters are not there yet, so persisted filter state is just ignored. At the point filter feature is installed, initial state had already been applied, so installed feature doesn't see any previous state.

20 Sep 2011, 7:25 AM