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 ?




On Wed, Jul 3, 2013 at 9:49 AM, Ken Muturi <muturiken@gmail.com> wrote:
Has anyone done some Sencha Grid (4.1) magic using  Ext.state.HttpProvider ?

When i do:

Ext.state.Manager.getProvider().initState( state_saved_in_db ); // [{"name":"grid-32","value":"............"}}]

It  Seems not to work