Observable Proxy ClientProxy WebStorageProxy LocalStorageProxy
Package: | Ext.data |
Defined In: | LocalStorageProxy.js |
Class: | LocalStorageProxy |
Extends: | WebStorageProxy |
Proxy which uses HTML5 local storage as its data storage/retrieval mechanism. If this proxy is used in a browser where local storage is not supported, the constructor will throw an error. A local storage proxy requires a unique ID which is used as a key in which all record data are stored in the local storage object.
It's important to supply this unique ID as it cannot be reliably determined otherwise. If no id is provided but the attached store has a storeId, the storeId will be used. If neither option is presented the proxy will throw an error.
Proxies are almost always used with a store:
new Ext.data.Store({
proxy: {
type: 'localstorage',
id : 'myProxyKey'
}
});
Alternatively you can instantiate the Proxy directly:
new Ext.data.LocalStorageProxy({
id : 'myOtherProxyKey'
});
Config Options | Defined By | |
---|---|---|
batchOrder : String Comma-separated ordering 'create', 'update' and 'destroy' actions when batching. Override this
to set a different ord... Comma-separated ordering 'create', 'update' and 'destroy' actions when batching. Override this
to set a different order for the batched CRUD actions to be executed in. Defaults to 'create,update,destroy' | Proxy | |
defaultReaderType : String The default registered reader type. Defaults to 'json' | Proxy | |
defaultWriterType : String The default registered writer type. Defaults to 'json' | Proxy | |
id : String The unique ID used as the key in which all record data are stored in the local storage object | WebStorageProxy | |
listeners : Object A config object containing one or more event handlers to be added to this
object during initialization. This should ... A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the addListener example for attaching multiple handlers at once. DOM events from ExtJs Components While some ExtJs Component classes export selected DOM events (e.g. "click", "mouseover" etc), this
is usually only done when extra value can be added. For example the DataView's
| Observable |
Property | Defined By | |
---|---|---|
cache : Object Cached map of records already retrieved by this Proxy - ensures that the same instance is always retrieved | WebStorageProxy |
Method | Defined By | |
---|---|---|
addEvents( Object|String o , string Optional. )
:
voidAdds the specified events to the list of events which this Observable may fire. Adds the specified events to the list of events which this Observable may fire. Parameters:
| Observable | |
addListener( String eventName , Function handler , [Object scope ], [Object options ] )
:
voidAppends an event handler to this object. Appends an event handler to this object. Parameters:
| Observable | |
addManagedListener( Observable|Element item , Object|String ename , Function fn , Object scope , Object opt )
:
voidAdds listeners to any Observable object (or Element) which are automatically removed when this Component
is destroyed... Adds listeners to any Observable object (or Element) which are automatically removed when this Component is destroyed. Parameters:
| Observable | |
batch( Object operations , Object listeners )
:
Ext.data.BatchPerforms a batch of Operations, in the order specified by batchOrder. Used internally by
Ext.data.Store's sync method... Performs a batch of Operations, in the order specified by batchOrder. Used internally by
Ext.data.Store's sync method. Example usage:
Where the myModel* above are Model instances - in this case 1 and 2 are new instances and have not been
saved before, 3 has been saved previously but needs to be updated, and 4 and 5 have already been saved but should now be destroyed.Parameters:
| Proxy | |
clear()
:
void Destroys all records stored in the proxy and removes all keys and values used to support the proxy from the storage o... Destroys all records stored in the proxy and removes all keys and values used to support the proxy from the storage object Parameters:
| WebStorageProxy | |
clearListeners()
:
void Removes all listeners for this object including the managed listeners Removes all listeners for this object including the managed listeners Parameters:
| Observable | |
clearManagedListeners()
:
void Removes all managed listeners for this object. Removes all managed listeners for this object. Parameters:
| Observable | |
create( Ext.data.Operation operation , Function callback , Object scope )
:
voidPerforms the given create operation. Performs the given create operation. Parameters:
| Proxy | |
destroy( Ext.data.Operation operation , Function callback , Object scope )
:
voidPerforms the given destroy operation. Performs the given destroy operation. Parameters:
| Proxy | |
enableBubble( String/Array events )
:
voidEnables events fired by this Observable to bubble up an owner hierarchy by calling
this.getBubbleTarget() if present.... Enables events fired by this Observable to bubble up an owner hierarchy by calling
This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component.getBubbleTarget. The default implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to access the required target more quickly. Example:
Parameters:
| Observable | |
fireEvent( String eventName , Object... args )
:
BooleanFires the specified event with the passed parameters (minus the event name).
An event may be set to bubble up an Obse... Fires the specified event with the passed parameters (minus the event name). An event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget) by calling enableBubble. Parameters:
| Observable | |
getModel()
:
Ext.data.Model Returns the model attached to this Proxy Returns the model attached to this Proxy Parameters:
| Proxy | |
getReader()
:
Ext.data.Reader Returns the reader currently attached to this proxy instance Returns the reader currently attached to this proxy instance Parameters:
| Proxy | |
getWriter()
:
Ext.data.Writer Returns the writer currently attached to this proxy instance Returns the writer currently attached to this proxy instance Parameters:
| Proxy | |
hasListener( String eventName )
:
BooleanChecks to see if this object has any listeners for a specified event Checks to see if this object has any listeners for a specified event Parameters:
| Observable | |
on( String eventName , Function handler , [Object scope ], [Object options ] )
:
voidAppends an event handler to this object (shorthand for addListener.) Appends an event handler to this object (shorthand for addListener.) Parameters:
| Observable | |
read( Ext.data.Operation operation , Function callback , Object scope )
:
voidPerforms the given read operation. Performs the given read operation. Parameters:
| Proxy | |
relayEvents( Object o , Array events )
:
voidRelays selected events from the specified Observable as if the events were fired by this. Relays selected events from the specified Observable as if the events were fired by this. Parameters:
| Observable | |
removeListener( String eventName , Function handler , [Object scope ] )
:
voidRemoves an event handler. Removes an event handler. Parameters:
| Observable | |
removeManagedListener( Observable|Element item , Object|String ename , Function fn , Object scope )
:
voidRemoves listeners that were added by the mon method. Removes listeners that were added by the mon method. Parameters:
| Observable | |
resumeEvents()
:
void Resume firing events. (see suspendEvents)
If events were suspended using the queueSuspended parameter, then all
event... Resume firing events. (see suspendEvents)
If events were suspended using the queueSuspended parameter, then all
events fired during event suspension will be sent to any listeners now. Parameters:
| Observable | |
setModel( String|Ext.data.Model model , Boolean setOnStore )
:
voidSets the model associated with this proxy. This will only usually be called by a Store Sets the model associated with this proxy. This will only usually be called by a Store Parameters:
| Proxy | |
setReader( String|Object|Ext.data.Reader reader )
:
Ext.data.ReaderSets the Proxy's Reader by string, config object or Reader instance Sets the Proxy's Reader by string, config object or Reader instance Parameters:
| Proxy | |
setRecord( Ext.data.Model record , String id )
:
voidSaves the given record in the Proxy. Runs each field's encode function (if present) to encode the data Saves the given record in the Proxy. Runs each field's encode function (if present) to encode the data Parameters:
| WebStorageProxy | |
setWriter( String|Object|Ext.data.Writer writer )
:
Ext.data.WriterSets the Proxy's Writer by string, config object or Writer instance Sets the Proxy's Writer by string, config object or Writer instance Parameters:
| Proxy | |
suspendEvents( Boolean queueSuspended )
:
voidSuspend the firing of all events. (see resumeEvents) Suspend the firing of all events. (see resumeEvents) Parameters:
| Observable | |
un( String eventName , Function handler , [Object scope ] )
:
voidRemoves an event handler (shorthand for removeListener.) Removes an event handler (shorthand for removeListener.) Parameters:
| Observable | |
update( Ext.data.Operation operation , Function callback , Object scope )
:
voidPerforms the given update operation. Performs the given update operation. Parameters:
| Proxy |