Copy codeThe Code is as follows:
Ext. state. CookieProvider = function (config ){
Ext. state. CookieProvider. superclass. constructor. call (this );
This. path = "/";
This. expires = new Date (). getTime () + (1000*60*60*24*7); // 7 days
This. domain = null;
This. secure = false;
Ext. apply (this, config );
This. state = this. readCookies ();
};
Ext. state. CookieProvider = function (config ){
Ext. state. CookieProvider. superclass. constructor. call (this );
This. path = "/";
This. expires = new Date (). getTime () + (1000*60*60*24*7); // 7 days
This. domain = null;
This. secure = false;
Ext. apply (this, config );
This. state = this. readCookies ();
};
We can change the default storage time by setting the expires value, for example:
Copy codeThe Code is as follows:
This. expires: new Date (). getTime () + (1000*60*60*24*365), // a year
This. expires: new Date (). getTime () + (1000*60*60*24*365), // a year
Alternatively, you can add the following code to the Ext. onReady function at the starting position.
Copy codeThe Code is as follows:
Ext. state. Manager. setProvider (
New Ext. state. CookieProvider ({
Expires: new Date (). getTime () + (1000*60*60*24*365), // a year
}));