Clear Up
SharpKit Reference

WebStorage Class

Namespace: Ext.data.proxy

Base Types

System.Object

Constructors

Name Description
WebStorage()
WebStorage(WebStorageConfig)
WebStorage(object) Creates the proxy, throws an error if local storage is not supported in the current browser. @param {Object} config (optional) Config object.

Properties

Name Description
alternateClassName @author Ed Spencer * WebStorageProxy is simply a superclass for the {@link Ext.data.proxy.LocalStorage localStorage} and {@link Ext.data.proxy.SessionStorage sessionStorage} proxies. It uses the new HTML5 key/value client-side storage objects to save {@link Ext.data.Model model instances} for offline use.
extend @author Ed Spencer * WebStorageProxy is simply a superclass for the {@link Ext.data.proxy.LocalStorage localStorage} and {@link Ext.data.proxy.SessionStorage sessionStorage} proxies. It uses the new HTML5 key/value client-side storage objects to save {@link Ext.data.Model model instances} for offline use.
Ids @private Saves the array of ids representing the set of all records in the Proxy @param {Number[]} ids The ids to set
NextId @private Returns the next numerical ID that can be used when realizing a model instance (see getRecordCounterKey). Increments the counter. @return {Number} The id
RecordCounterKey @private Returns the unique key used to store the current record counter for this proxy. This is used internally when realizing models (creating them when they used to be phantoms), in order to give each model instance a unique id. @return {String} The counter key
StorageObject @private Abstract function which should return the storage object that data will be saved to. This must be implemented in each subclass. @return {Object} The storage object

Methods

Name Description
clear() Destroys all records stored in the proxy and removes all keys and values used to support the proxy from the storage object.
create(object, object, object)
destroy(object, object, object)
getIds() @private Returns the array of record IDs stored in this Proxy @return {Number[]} The record IDs. Each is cast as a Number
getNextId() @private Returns the next numerical ID that can be used when realizing a model instance (see getRecordCounterKey). Increments the counter. @return {Number} The id
getRecord(JsString) @private Fetches a model instance from the Proxy by ID. Runs each field's decode function (if present) to decode the data. @param {String} id The record's unique ID @return {Ext.data.Model} The model instance
getRecordCounterKey() @private Returns the unique key used to store the current record counter for this proxy. This is used internally when realizing models (creating them when they used to be phantoms), in order to give each model instance a unique id. @return {String} The counter key
getRecordKey(object) @private Given the id of a record, returns a unique string based on that id and the id of this proxy. This is used when storing data in the local storage object and should prevent naming collisions. @param {String/Number/Ext.data.Model} id The record id, or a Model instance @return {String} The unique key for this record
getStorageObject() @private Abstract function which should return the storage object that data will be saved to. This must be implemented in each subclass. @return {Object} The storage object
initialize() @private Sets up the Proxy by claiming the key in the storage object that corresponds to the unique id of this Proxy. Called automatically by the constructor, this should not need to be called again unless {@link #clear} has been called.
read(object, object, object)
removeRecord(object, object) @private Physically removes a given record from the local storage. Used internally by {@link #destroy}, which you should use instead because it updates the list of currently-stored record ids @param {String/Number/Ext.data.Model} id The id of the record to remove, or an Ext.data.Model instance
setIds(object) @private Saves the array of ids representing the set of all records in the Proxy @param {Number[]} ids The ids to set
setRecord(Model, JsString) Saves the given record in the Proxy. Runs each field's encode function (if present) to encode the data. @param {Ext.data.Model} record The model instance @param {String} id The id to save the record under (defaults to the value of the record's getId() function)
update(object, object, object)
© Copyright 2005-2011 SharpKit. All rights reserved.