Print Friendly

Class Ext.state.CookieProvider

Package:Ext.state
Class:CookieProvider
Extends:Provider
Defined In:State.js
The default Provider implementation which saves state via cookies.
Usage:
var cp = new Ext.state.CookieProvider({
       path: "/cgi-bin/",
       expires: new Date(new Date().getTime()+(1000*60*60*24*30)); //30 days
       domain: "extjs.com"
   })
   Ext.state.Manager.setProvider(cp);

Properties   -  Methods   -  Events   -  Config Options

Public Properties

This class has no public properties.

Public Methods

Method Defined By
  CookieProviderObject config ) CookieProvider
Create a new CookieProvider
  clearString name ) : void Provider
Clears a value from the state
  decodeValueString value ) : Mixed Provider
Decodes a string previously encoded with encodeValue.
  encodeValueMixed value ) : String Provider
Encodes a value including type information. Decode with decodeValue.
  getString name, Mixed defaultValue ) : Mixed Provider
Returns the current value for a key
  setString name, Mixed value ) : void Provider
Sets the value for a key

Public Events

Event Defined By
  statechange : ( Provider this, String key, String value ) Provider
Fires when a state change occurs.

Config Options

Config Options Defined By
  domain : String CookieProvider
The domain to save the cookie for. Note that you cannot specify a different domain than your page is on, but you can ...
  expires : Date CookieProvider
The cookie expiration date (defaults to 7 days from now)
  path : String CookieProvider
The path for which the cookie is active (defaults to root '/' which makes it active for all pages in the site)
  secure : Boolean CookieProvider
True if the site is using SSL (defaults to false)

Constructor Details

CookieProvider

public function CookieProvider( Object config )
Create a new CookieProvider
Parameters:
  • config : Object
    The configuration object

Method Details

clear

public function clear( String name )
Clears a value from the state
Parameters:
  • name : String
    The key name
Returns:
  • void
This method is defined by Provider.

decodeValue

public function decodeValue( String value )
Decodes a string previously encoded with encodeValue.
Parameters:
  • value : String
    The value to decode
Returns:
  • Mixed
    The decoded value
This method is defined by Provider.

encodeValue

public function encodeValue( Mixed value )
Encodes a value including type information. Decode with decodeValue.
Parameters:
  • value : Mixed
    The value to encode
Returns:
  • String
    The encoded value
This method is defined by Provider.

get

public function get( String name, Mixed defaultValue )
Returns the current value for a key
Parameters:
  • name : String
    The key name
  • defaultValue : Mixed
    A default value to return if the key's value is not found
Returns:
  • Mixed
    The state data
This method is defined by Provider.

set

public function set( String name, Mixed value )
Sets the value for a key
Parameters:
  • name : String
    The key name
  • value : Mixed
    The value to set
Returns:
  • void
This method is defined by Provider.

Event Details

statechange

public event statechange
Fires when a state change occurs.
Subscribers will be called with the following parameters:
  • this : Provider
    This state provider
  • key : String
    The state key which was changed
  • value : String
    The encoded value for the state
This event is defined by Provider.

Config Details

domain

domain : String
The domain to save the cookie for. Note that you cannot specify a different domain than your page is on, but you can specify a sub-domain, or simply the domain itself like 'extjs.com' to include all sub-domains if you need to access cookies across different sub-domains (defaults to null which uses the same domain the page is running on including the 'www' like 'www.extjs.com')
This config option is defined by CookieProvider.

expires

expires : Date
The cookie expiration date (defaults to 7 days from now)
This config option is defined by CookieProvider.

path

path : String
The path for which the cookie is active (defaults to root '/' which makes it active for all pages in the site)
This config option is defined by CookieProvider.

secure

secure : Boolean
True if the site is using SSL (defaults to false)
This config option is defined by CookieProvider.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.