Session setting in EXTJS

We usually play with session and create the session by server side script like PHP. But, how we create session with client side script?

In this case is EXTJS. OK… You can store cookie instead of session for this case.

This is the code;

The first thing you need to do is setProvider and set a variable into it;

Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.state.Manager.set("varA",varA);

And then to get varA from cookies;

Ext.state.Manager.get("varA")

And if you need to clear that value from cookies

Ext.state.Manager.clear("varA");

That’s it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s