PDA

View Full Version : Ext.state.Manager.getProvider().destroy method giving error



sudhir.gupta.eck
4 Oct 2016, 8:19 AM
Hi ,

I am working on EXTJS 3.4 application where I need to save user preferences.
I am using below code and its working perfectly fine for saving preferences via cookies.

var cp = new Ext.state.CookieProvider({
expires: new Date(new Date().getTime()+(1000*60*60*24*30)) //30 days
});
Ext.state.Manager.setProvider(cp);
var grid = new Ext.grid.EditorGridPanel({
store: store,
cm: cm,
stateful: true,
stateId: 'mygridState',
..........................................................)}

But when I try to logout the application, I am getting below error from EXTJS framwork

" Uncaught TypeError: Ext.state.Manager.getProvider(...).destroy is not a function "

I have below questions ;

1) How can I handle this error?
2) I dont want to clear cache when user logout from the application.
3) Can it be possible to not to write any code in logout function , or I can declare something where I have created cookies because our application is hosted under other application and sign out method dosent fall in our application.

Any inputs will be really helpful.

Gary Schlosberg
5 Oct 2016, 11:15 AM
How are you logging out of the application?

sudhir.gupta.eck
13 Oct 2016, 12:03 AM
Hi Gary ,

Sorry for the late reply :
The logout method is as below :

terminate : function() {

Ext.TaskMgr.stopAll(); // kill all tasks (Alert polling, Spotlight etc..)

var progress = Ext.Msg.show({
buttons: false,
.....
width: 400
});

var body = Ext.getBody(),
hosts = config.logoutUris || [],
........
finalUri;

/*
* Save any pending state changes
*/

Ext.state.Manager.getProvider().destroy();

.....

//Brute force cookie delete
actions.deleteAllCookies ();
......................


My code breaks at highlighted line ( i.e. Ext.state.Manager.getProvider().destroy(); )

Kindly help.


Thanks
Sudhir