PDA

View Full Version : ExtJS - session variable



epi82
20 Feb 2011, 8:38 AM
Hello,

I have a treePanel with a listener on "checkchange".


tree.addListener('checkchange',function(node, checked){
var list = new Array();
var i = 0;
var sel = tree.getChecked();
Ext.each(sel, function (nodes) {
list[i] = nodes.id;
switch(list[i])
{
case 'mo1_1':
mo1_val=1;
break;
case 'mo1_2':
mo1_val=2;
break;
case 'mo1_3':
mo1_val=3;
break;
case 'mo1_4':
mo1_val=4;
break;
case 'mo1_5':
mo1_val=5;
break;
case 'mo1_6':
mo1_val=6;
break;
case 'mo1_7':
mo1_val=7;
break;
case 'mo1_8':
mo1_val=8;
break;
case 'mo1_9':
mo1_val=9;
break;
}
i++;
GridSpe.store.removeAll();
GridSpe.store.proxy.setUrl('get-data-for-gridspe.php?morfo1='+mo1_val);
GridSpe.store.reload();
});
});

I want to save my "mo1_val" value in something like a session variable.

How can I do that?


Thank you very much.

ryanyoungsma
20 Feb 2011, 6:06 PM
You can use Ext's cookieprovider to do what you are looking for.

epi82
23 Feb 2011, 6:22 AM
Hello,

thank you for your answer.

I've done something like this and it's working!


Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
...

Ext.state.Manager.set("mo1_val",mo1_val);
...

//and then to get mo1_val from cookies
Ext.state.Manager.get("mo1_val")
...

//if you need to clear that value from cookies
Ext.state.Manager.clear("mo1_val");

I hope this could help someone.

Bye

alxs17
3 Sep 2011, 3:39 AM
Hey !!

Thanks for your thread.

So I can remove a variable (cookie) from my state manager, but do you know how I can remove all cookie without executing a state.manager.clear(...) on each cookie ?

wkh7777
30 Sep 2014, 2:10 AM
Thanks a lot!!!