People :-
I have created my own plugin for the above by extending Ext.state.Provider that saves the state of a grid to a db (filters, grouping, sorting, column size, etc) :-
Ext.define('Ext.state.HttpProvider', {
extend: 'Ext.state.Provider',
constructor: function(config) {
Ext.state.HttpProvider.superclass.constructor.call(this);
this.url = "";
Ext.apply(this, config);
this.state = this.readValues();
},
// private
set : function(name, value){
if(typeof value == "undefined" || value === null){
this.clear(name);
return;
}
this.setValue(name, value);
Ext.state.HttpProvider.superclass.set.call(this, name, value);
},
// private
clear : function(name){
this.clearValue(name);
Ext.state.HttpProvider.superclass.clear.call(this, name);
},
// private
readValues : function(){
var state = {};
for (var name in ExtState)
{
if(name!='remove')
{
state[name] = this.decodeValue(ExtState[name]);
}
}
return state;
},
// private
setValue : function(name, value){
var conn = new Ext.data.Connection();
conn.request({
url: this.url,
params: {task: 'set', 'name': name, 'value': this.encodeValue(value) },
});
},
// private
clearValue : function(name){
var conn = new Ext.data.Connection();
conn.request({
url: this.url,
params: {task: 'set', 'name': name, 'value': 'null' },
});
}
});
// calling it from the grid.
var ExtState = Ext.decode('<?php echo json_encode($grid_state); ?>');
var _cp = Ext.create('Ext.state.HttpProvider', { url: save_grid_state_url });
Ext.state.Manager.setProvider(cp);
On console.log @ readValues() and setValues() they have the correct Extjs4 grid state but sencha will not bulge.
Has someone worked on something like this before ?