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
Overrides _Module
All initializations, if any, must be done in the constructor, instead of the load function.
Parameter | Type | Description |
---|---|---|
grid | Object | The grid itself. |
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.
Parameter | Type | Description |
---|---|---|
name | String | Name of a feature. |
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.
Parameter | Type | Description |
---|---|---|
name | String | Name of a feature. |
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.
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.
Parameter | Type | Description |
---|---|---|
key |
Overrides _Module
Returns Boolean
Check whether a feature is enabled or not.
Parameter | Type | Description |
---|---|---|
name | String | Name of a feature. If omitted, means every feature. return: Whether this feature (or every feature) is enabled. |
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.
Parameter | Type | Description |
---|---|---|
key | String | The persist key of this grid. |
value | Object | A JSON object, containing everything we want to persist for this grid. |
options |
Overrides _Module
Returns Object
Register a feature to be persisted, and then load (return) its contents.
Parameter | Type | Description |
---|---|---|
name | String | A unique name of the feature to be persisted. |
saver | Function() | return object A function to be called when persisting the grid. return: The loaded contents of the given feature. |
scope |