javascript Ext JS 狀態(tài)默認(rèn)存儲時間
更新時間:2009年02月15日 18:29:54 作者:
通過ExtJS的源碼可以知道,ExtJS將Grid的自定義顯示列等自定義狀態(tài)信息存入Cookie中,默認(rèn)時間為7天
復(fù)制代碼 代碼如下:
Ext.state.CookieProvider = function(config){
Ext.state.CookieProvider.superclass.constructor.call(this);
this.path = "/";
this.expires = new Date(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(new Date().getTime()+(1000*60*60*24*7)); //7 days
this.domain = null;
this.secure = false;
Ext.apply(this, config);
this.state = this.readCookies();
};
我們可以通過設(shè)定expires的值來改變默認(rèn)的存儲時間,比如:
復(fù)制代碼 代碼如下:
this.expires: new Date(new Date().getTime()+(1000*60*60*24*365)), //一年
this.expires: new Date(new Date().getTime()+(1000*60*60*24*365)), //一年
或者我們可以在開始位置的Ext.onReady函數(shù)中加上以下的代碼
復(fù)制代碼 代碼如下:
Ext.state.Manager.setProvider(
new Ext.state.CookieProvider({
expires: new Date(new Date().getTime()+(1000*60*60*24*365)), //一年
}));
您可能感興趣的文章:
- ExtJS與PHP、MySQL實(shí)現(xiàn)存儲的方法
- javascript js cookie的存儲,獲取和刪除
- Node.js中調(diào)用mysql存儲過程示例
- 什么是cookie?js手動創(chuàng)建和存儲cookie
- js瀏覽器本地存儲store.js介紹及應(yīng)用
- jsp使用cookie存儲中文示例分享
- 用JavaScript計(jì)算在UTF-8下存儲字符串占用字節(jié)數(shù)
- JavaScript筆記之?dāng)?shù)據(jù)屬性和存儲器屬性
- JSON復(fù)雜數(shù)據(jù)處理之Json樹形結(jié)構(gòu)數(shù)據(jù)轉(zhuǎn)Java對象并存儲到數(shù)據(jù)庫的實(shí)現(xiàn)
- js仿微博實(shí)現(xiàn)統(tǒng)計(jì)字符和本地存儲功能
- 瀏覽器中url存儲的JavaScript實(shí)現(xiàn)
- JavaScript實(shí)現(xiàn)基于Cookie的存儲類實(shí)例
- 總結(jié)JavaScript三種數(shù)據(jù)存儲方式之間的區(qū)別
相關(guān)文章
Extjs中RowExpander控件的默認(rèn)展開問題示例探討
本文為大家探討下關(guān)于Extjs中RowExpander控件的默認(rèn)展開問題,下面有個不錯的示例,感興趣的朋友可以參考下2014-01-01Extjs 4.x 得到form CheckBox 復(fù)選框的值
CheckBox(復(fù)選框)主要用來接收用戶選擇的選項(xiàng),那么如何通過Extjs 4.x 得到form CheckBox的值呢?下面有個不錯的方法,大家值得一看2014-05-05Extjs學(xué)習(xí)過程中新手容易碰到的低級錯誤積累
新手在學(xué)習(xí)Extjs過程中的低級錯誤積累2010-02-02Extjs gridpanel 出現(xiàn)橫向滾動條問題的解決方法
Extjs gridpanel 出現(xiàn)橫向滾動條問題的解決方法,在gridpanel中加入以下代碼即可。2011-07-07Extjs NumberField后面加單位實(shí)現(xiàn)思路
本文為大家介紹下在NumberField后面加單位,具體實(shí)現(xiàn)如下,感興趣的朋友可以參考下2013-07-07