javascript 使用 sencha extjs 从 cookie 访问值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4249526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 10:47:47  来源:igfitidea点击:

Access values from cookies using sencha extjs

javascriptextjscookies

提问by Tejas

I am pretty new to senchaas well as JavaScript. So can you please help me with how to use Sencha ExtJS and extract information from cookies. I have set the state of a gridpanel in cookies and now I want to extract the value of columnOrder and other information from cookies.

我对sencha和 JavaScript都很陌生。那么你能帮助我如何使用 Sencha ExtJS 并从 cookie 中提取信息。我已经在 cookie 中设置了 gridpanel 的状态,现在我想从 cookie 中提取 columnOrder 的值和其他信息。

Any code or reference will be really appreciated.

任何代码或参考将不胜感激。

回答by Dave

First thing - if you haven't found these already, here is a link to the Ext docs:

首先 - 如果你还没有找到这些,这里是Ext 文档的链接:

http://docs.sencha.com/extjs

http://docs.sencha.com/extjs

Second - here is a link to Ext.util.Cookies:

其次 - 这是Ext.util.Cookies的链接:

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.util.Cookies

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.util.Cookies

Example of use:

使用示例:

// write cookie
var myCookie = Ext.util.Cookies.set('YourCookieName', 'YourValue');

// read cookie
Ext.util.Cookies.get('YourCookieName');

回答by Tejas

Write cookie

写饼干

var myCookie = Ext.util.Cookies.set('YourCookieName', 'YourValue');

Read cookie

读取cookie

Ext.util.Cookies.get('YourCookieName');