ExtJs operation Cookie
The ExtJs Cookie operation method is very simple. There are only three methods:
Clear (name): clear the value set for name.
Set (name, value): set the value of name to value.
Get (name): get the value set for name.
The following is an example:
Ext. onReady (function () {var stringtest = "this is a string"; var obj = {name: "this is name", description: "this id description"}; Ext. util. cookies. set ("test1", stringtest); Ext. util. cookies. set ("test2", Ext. encode (obj); Ext. msg. alert ("prompt", "first parameter:" + Ext. util. cookies. get ("test1") + "\ n second parameter string format:" + Ext. util. cookies. get ("test2") + "\ n get the second string name attribute value:" + Ext. decode (Ext. util. cookies. get ("test2 ")). name );});Note that cookies can only store strings, but cannot store objects. To store objects, use Ext first. the encode () method converts a complex object structure to a string, but you need to use Ext to retrieve the string. decode () to convert the string to the original object type. If the object also contains an object, the toString () method of the internal object will be called when the encode is used. The stored type is "object" and the data type is not stored, when the decode method is called, the object is converted back to a string instead of the original object.
The running result of the preceding example is as follows: