Ext.state.HttpProvider to store state in database

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

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

@Muturi, maybe if you cast your nets in Lake SO you just might find someone who has previously caught the fish you are looking for :-) On 3 Jul 2013, at 14:02, Ken Muturi <muturiken@gmail.com> wrote:
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
_______________________________________________ skunkworks mailing list skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke

@peter Lake SO ? On Wed, Jul 3, 2013 at 3:18 PM, Peter Karunyu <pkarunyu@gmail.com> wrote:
@Muturi, maybe if you cast your nets in Lake SO you just might find someone who has previously caught the fish you are looking for :-)
On 3 Jul 2013, at 14:02, Ken Muturi <muturiken@gmail.com> wrote:
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
_______________________________________________ skunkworks mailing list skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
_______________________________________________ skunkworks mailing list skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke

aha, Stackoverflow.. lemmi do that On Wed, Jul 3, 2013 at 3:27 PM, Ken Muturi <muturiken@gmail.com> wrote:
@peter Lake SO ?
On Wed, Jul 3, 2013 at 3:18 PM, Peter Karunyu <pkarunyu@gmail.com> wrote:
@Muturi, maybe if you cast your nets in Lake SO you just might find someone who has previously caught the fish you are looking for :-)
On 3 Jul 2013, at 14:02, Ken Muturi <muturiken@gmail.com> wrote:
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
_______________________________________________ skunkworks mailing list skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
_______________________________________________ skunkworks mailing list skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke

1. What do you mean by "sencha will not bulge" 2. Get rid of the commas after the last configs 3. What other errors are you getting from your console.log it will be easier to start from there. 4. Can you post your code on http://jsfiddle.net/ then share the link before I go in and see what you are doing wrong :) ----- Original Message ----- | From: "Ken Muturi" <muturiken@gmail.com> | To: "Skunkworks Mailing List" <skunkworks@lists.my.co.ke> | Sent: Miércoles, 3 de Julio 2013 12:02:05 | Subject: Re: [Skunkworks] Ext.state.HttpProvider to store state in | database | 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 | | _______________________________________________ | skunkworks mailing list | skunkworks@lists.my.co.ke | ------------ | List info, subscribe/unsubscribe | http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks | ------------ | Skunkworks Rules | http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 | ------------ | Other services @ http://my.co.ke
participants (3)
-
Ken Muturi
-
Peter Karunyu
-
Steve Obbayi