gridx
Legend: Array Boolean Constructor Date DomNode Error Function Namespace Number Object RegExp Singleton String

gridx.modules.Persist

Object » _Module » gridx.modules.Persist
dojo.require("gridx.modules.Persist");
Defined in gridx/modules/Persist.js

Provide a mechanism to persist various grid features when the grid is destroyed, so that when a new grid with the same id (or the same persist key) is created, all these features will be restored. By default use cookie, but users can also provide custom put and get functions. Note: since dojox.storage is still experimental, and with HTML5 we will hardly need things like gears or behavior storage, so we aren't supporting dojox.storage by default.

Method Summary

  • _columnStateSaver()
  • _restoreColumnState()
  • _setEnable(name, enabled)
  • constructor(grid) All initializations, if any, must be done in the constructor, instead of the load function.
  • disable(name) Disable persistance of the given feature, that is, will NOT persist this feature when the save function is called. If name is not provided (undefined or null), then disable all registered features.
  • enable(name) Enable persistance of the given feature, that is, will persist this feature when the save function is called. If name is not provided (undefined or null), then enable all registered features.
  • features() returns String[] Get the names of all the persistable features. These names can be used in enable(), disable() or isEnabled() methods. return: An array of persistable feature names.
  • get(key) returns Object This is NOT a public method, but users can provide their own to override it. This function is called when loading things from storage. return: Then things we stored before.
  • getAPIPath()
  • isEnabled(name) returns Boolean Check whether a feature is enabled or not.
  • put(key, value, options) This is NOT a public method, but users can provide their own to override it. This function is called when finally saving things into some kind of storage.
  • registerAndLoad(name, saver, scope) returns Object Register a feature to be persisted, and then load (return) its contents.
  • save() Save all the enabled features.

Methods

_columnStateSaver
Overrides _Module
_restoreColumnState
Overrides _Module
_setEnable
Overrides _Module
ParameterTypeDescription
name
enabled
constructor
Overrides _Module
All initializations, if any, must be done in the constructor, instead of the load function.
ParameterTypeDescription
gridObjectThe grid itself.
disable
Overrides _Module
Disable persistance of the given feature, that is, will NOT persist this feature when the save function is called. If name is not provided (undefined or null), then disable all registered features.
ParameterTypeDescription
nameStringName of a feature.
enable
Overrides _Module
Enable persistance of the given feature, that is, will persist this feature when the save function is called. If name is not provided (undefined or null), then enable all registered features.
ParameterTypeDescription
nameStringName of a feature.
features
Overrides _Module
Returns String[]
Get the names of all the persistable features. These names can be used in enable(), disable() or isEnabled() methods. return: An array of persistable feature names.
get
Overrides _Module
Returns Object
This is NOT a public method, but users can provide their own to override it. This function is called when loading things from storage. return: Then things we stored before.
ParameterTypeDescription
key
getAPIPath
Overrides _Module
isEnabled
Overrides _Module
Returns Boolean
Check whether a feature is enabled or not.
ParameterTypeDescription
nameStringName of a feature. If omitted, means every feature. return: Whether this feature (or every feature) is enabled.
put
Overrides _Module
This is NOT a public method, but users can provide their own to override it. This function is called when finally saving things into some kind of storage.
ParameterTypeDescription
keyStringThe persist key of this grid.
valueObjectA JSON object, containing everything we want to persist for this grid.
options
registerAndLoad
Overrides _Module
Returns Object
Register a feature to be persisted, and then load (return) its contents.
ParameterTypeDescription
nameStringA unique name of the feature to be persisted.
saverFunction()return object A function to be called when persisting the grid. return: The loaded contents of the given feature.
scope
save
Overrides _Module
Save all the enabled features.