Observable Store JsonStore
Package: | Ext.data |
Defined In: | JsonStore.js |
Class: | JsonStore |
Extends: | Store |
var store = new Ext.data.JsonStore({
url: 'get-images.php',
root: 'images',
fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}]
});
This would consume a returned object of the form:
{
images: [
{name: 'Image one', url:'/GetImage.php?id=1', size:46.5, lastmod: new Date(2007, 10, 29)},
{name: 'Image Two', url:'/GetImage.php?id=2', size:43.2, lastmod: new Date(2007, 10, 30)}
]
}
An object literal of this form could also be used as the data config option.
Note: Although they are not listed, this class inherits all of the config options of Store,
JsonReader. Config Options | Defined By | |
---|---|---|
autoLoad : Boolean/Object
If passed, this store's load method is automatically called after creation with the autoLoad object
|
Store | |
baseParams : Object
An object containing properties which are to be sent as parameters on any HTTP request
|
Store | |
data : Object
A data object readable this object's JsonReader. Either this option, or the url option must be specified.
|
JsonStore | |
fields : Array Either an Array of field definition objects as passed to Ext.data.Record.create, or a Record constructor created usin...
Either an Array of field definition objects as passed to Ext.data.Record.create, or a Record constructor created using Ext.data.Record.create.
|
JsonStore | |
listeners : Object A config object containing one or more event handlers to be added to this object during initialization. This should b...
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.
|
Observable | |
proxy : Ext.data.DataProxy
The Proxy object which provides access to a data object.
|
Store | |
pruneModifiedRecords : boolean True to clear all modified record information each time the store is loaded or when a record is removed. (defaults to...
True to clear all modified record information each time the store is loaded or when a record is removed. (defaults to false).
|
Store | |
reader : Ext.data.Reader The Reader object which processes the data object and returns an Array of Ext.data.record objects which are cached ke...
The Reader object which processes the data object and returns an Array of Ext.data.record objects which are cached keyed by their id property.
|
Store | |
remoteSort : boolean True if sorting is to be handled by requesting the Proxy to provide a refreshed version of the data object in sorted ...
True if sorting is to be handled by requesting the Proxy to provide a refreshed version of the data object in sorted order, as opposed to sorting the Record cache in place (defaults to false).
If remote sorting is specified, then clicking on a column header causes the current page to be requested from the server with the addition of the following two parameters:
|
Store | |
sortInfo : Object
A config object in the format: {field: "fieldName", direction: "ASC|DESC"}
|
Store | |
storeId : String
If passed, the id to use to register with the StoreMgr
|
Store | |
url : String
The URL from which to load data through an HttpProxy. Either this option, or the data option must be specified.
|
JsonStore |
Property | Defined By | |
---|---|---|
baseParams : Object
An object containing properties which are used as parameters on any HTTP request.
|
Store | |
lastOptions : Object Contains the last options object used as the parameter to the load method. See load
for the details of what this may ...
Contains the last options object used as the parameter to the load method. See load
for the details of what this may contain. This may be useful for accessing any params which
were used to load the current Record cache.
|
Store |
Method | Defined By | |
---|---|---|
JsonStore( Object config )
Parameters:
|
JsonStore | |
add( Ext.data.Record[] records ) : void Add Records to the Store and fires the add event.
Add Records to the Store and fires the add event.
Parameters:
|
Store | |
addEvents( Object object ) : void Used to define events on this Observable
Used to define events on this Observable
Parameters:
|
Observable | |
addListener( String eventName , Function handler , [Object scope ], [Object options ] ) : void Appends an event handler to this component
Appends an event handler to this component
Parameters:
|
Observable | |
addSorted( Ext.data.Record record ) : void (Local sort only) Inserts the passed the record in the Store at the index where it
should go based on the current sor...
(Local sort only) Inserts the passed the record in the Store at the index where it
should go based on the current sort information
Parameters:
|
Store | |
clearFilter( Boolean suppressEvent ) : void Revert to a view of the Record cache with no filtering applied.
Revert to a view of the Record cache with no filtering applied.
Parameters:
|
Store | |
collect( String dataIndex , [Boolean allowNull ], [Boolean bypassFilter ] ) : Array Collects unique values for a particular dataIndex from this store.
Collects unique values for a particular dataIndex from this store.
Parameters:
|
Store | |
commitChanges() : void Commit all Records with outstanding changes. To handle updates for changes, subscribe to the
Store's "update" event, ...
Commit all Records with outstanding changes. To handle updates for changes, subscribe to the
Store's "update" event, and perform updating when the third parameter is Ext.data.Record.COMMIT.
Parameters:
|
Store | |
each( Function fn , [Object scope ] ) : void Calls the specified function for each of the Records in the cache.
Calls the specified function for each of the Records in the cache.
Parameters:
|
Store | |
filter( String field , String/RegExp value , [Boolean anyMatch ], [Boolean caseSensitive ] ) : void Filter the records by a specified property.
Filter the records by a specified property.
Parameters:
|
Store | |
filterBy( Function fn , [Object scope ] ) : void Filter by a function. The specified function will be called for each
Record in this Store. If the function returns tr...
Filter by a function. The specified function will be called for each
Record in this Store. If the function returns true the Record is included,
otherwise it is filtered out.
Parameters:
|
Store | |
find( String property , String/RegExp value , [Number startIndex ], [Boolean anyMatch ], [Boolean caseSensitive ] ) : Number Finds the index of the first matching record in this store by a specific property/value.
Finds the index of the first matching record in this store by a specific property/value.
Parameters:
|
Store | |
findBy( Function fn , [Object scope ], [Number startIndex ] ) : Number Find the index of the first matching Record in this Store by a function.
If the function returns true it is considere...
Find the index of the first matching Record in this Store by a function.
If the function returns true it is considered a match.
Parameters:
|
Store | |
fireEvent( String eventName , Object... args ) : Boolean Fires the specified event with the passed parameters (minus the event name).
Fires the specified event with the passed parameters (minus the event name).
Parameters:
|
Observable | |
getAt( Number index ) : Ext.data.Record Get the Record at the specified index.
Get the Record at the specified index.
Parameters:
|
Store | |
getById( String id ) : Ext.data.Record Get the Record with the specified id.
Get the Record with the specified id.
Parameters:
|
Store | |
getCount() : Number Gets the number of cached records.
If using paging, this may not be the total size of the dataset. If the data object...
Gets the number of cached records.
If using paging, this may not be the total size of the dataset. If the data object used by the Reader contains the dataset size, then the getTotalCount function returns the dataset size.
Parameters:
|
Store | |
getModifiedRecords() : Ext.data.Record[] Gets all records modified since the last commit. Modified records are persisted across load operations
(e.g., during...
Gets all records modified since the last commit. Modified records are persisted across load operations
(e.g., during paging).
Parameters:
|
Store | |
getRange( [Number startIndex ], [Number endIndex ] ) : Ext.data.Record[] Returns a range of Records between specified indices.
Returns a range of Records between specified indices.
Parameters:
|
Store | |
getSortState() : Object Returns an object describing the current sort state of this Store.
Returns an object describing the current sort state of this Store.
Parameters:
|
Store | |
getTotalCount() : Number Gets the total number of records in the dataset as returned by the server.
If using paging, for this to be accurate, ...
Gets the total number of records in the dataset as returned by the server.
If using paging, for this to be accurate, the data object used by the Reader must contain the dataset size. For remote data sources, this is provided by a query on the server.
Parameters:
|
Store | |
hasListener( String eventName ) : Boolean Checks 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 | |
indexOf( Ext.data.Record record ) : Number Get the index within the cache of the passed Record.
Get the index within the cache of the passed Record.
Parameters:
|
Store | |
indexOfId( String id ) : Number Get the index within the cache of the Record with the passed id.
Get the index within the cache of the Record with the passed id.
Parameters:
|
Store | |
insert( Number index , Ext.data.Record[] records ) : void Inserts Records to the Store at the given index and fires the add event.
Inserts Records to the Store at the given index and fires the add event.
Parameters:
|
Store | |
isFiltered() : Boolean Returns true if this store is currently filtered
Returns true if this store is currently filtered
Parameters:
|
Store | |
load( Object options ) : void Loads the Record cache from the configured Proxy using the configured Reader.
If using remote paging, then the first ...
Loads the Record cache from the configured Proxy using the configured Reader.
If using remote paging, then the first load call must specify the start and limit properties in the options.params property to establish the initial position within the dataset, and the number of Records to cache on each read from the Proxy. It is important to note that for remote data sources, loading is asynchronous, and this call will return before the new data has been loaded. Perform any post-processing in a callback function, or in a "load" event handler.
Parameters:
|
Store | |
loadData( Object data , [Boolean append ] ) : void Loads data from a passed data block. A Reader which understands the format of the data
must have been configured in t...
Loads data from a passed data block. A Reader which understands the format of the data
must have been configured in the constructor.
Parameters:
|
Store | |
on( String eventName , Function handler , [Object scope ], [Object options ] ) : void Appends an event handler to this element (shorthand for addListener)
Appends an event handler to this element (shorthand for addListener)
Parameters:
|
Observable | |
purgeListeners() : void Removes all listeners for this object
Removes all listeners for this object
Parameters:
|
Observable | |
query( String field , String/RegExp value , [Boolean anyMatch ], [Boolean caseSensitive ] ) : MixedCollection Query the records by a specified property.
Query the records by a specified property.
Parameters:
|
Store | |
queryBy( Function fn , [Object scope ] ) : MixedCollection Query the cached records in this Store using a filtering function. The specified function
will be called with each re...
Query the cached records in this Store using a filtering function. The specified function
will be called with each record in this Store. If the function returns true the record is
included in the results.
Parameters:
|
Store | |
rejectChanges() : void Cancel outstanding changes on all changed records.
Cancel outstanding changes on all changed records.
Parameters:
|
Store | |
reload( [Object options ] ) : void Reloads the Record cache from the configured Proxy using the configured Reader and
the options from the last load ope...
Reloads the Record cache from the configured Proxy using the configured Reader and
the options from the last load operation performed.
Parameters:
|
Store | |
remove( Ext.data.Record record ) : void Remove a Record from the Store and fires the remove event.
Remove a Record from the Store and fires the remove event.
Parameters:
|
Store | |
removeAll() : void Remove all Records from the Store and fires the clear event.
Remove all Records from the Store and fires the clear event.
Parameters:
|
Store | |
removeListener( String eventName , Function handler , [Object scope ] ) : void Removes a listener
Removes a listener
Parameters:
|
Observable | |
resumeEvents() : void Resume firing events. (see suspendEvents)
Resume firing events. (see suspendEvents)
Parameters:
|
Observable | |
setDefaultSort( String fieldName , [String dir ] ) : void Sets the default sort column and order to be used by the next load operation.
Sets the default sort column and order to be used by the next load operation.
Parameters:
|
Store | |
sort( String fieldName , [String dir ] ) : void Sort the Records.
If remote sorting is used, the sort is performed on the server, and the cache is
reloaded. If local...
Sort the Records.
If remote sorting is used, the sort is performed on the server, and the cache is
reloaded. If local sorting is used, the cache is sorted internally.
Parameters:
|
Store | |
sum( String property , Number start , Number end ) : Number Sums the value of property for each record between start and end and returns the result.
Sums the value of property for each record between start and end and returns the result.
Parameters:
|
Store | |
suspendEvents() : void Suspend the firing of all events. (see resumeEvents)
Suspend the firing of all events. (see resumeEvents)
Parameters:
|
Observable | |
un( String eventName , Function handler , [Object scope ] ) : void Removes a listener (shorthand for removeListener)
Removes a listener (shorthand for removeListener)
Parameters:
|
Observable |
Event | Defined By | |
---|---|---|
add : ( Store this , Ext.data.Record[] records , Number index ) Fires when Records have been added to the Store
Fires when Records have been added to the Store
Listeners will be called with the following arguments:
|
Store | |
beforeload : ( Store this , Object options ) Fires before a request is made for a new data object. If the beforeload handler returns false
the load action will b...
Fires before a request is made for a new data object. If the beforeload handler returns false
the load action will be canceled.
Listeners will be called with the following arguments:
|
Store | |
clear : ( Store this ) Fires when the data cache has been cleared.
Fires when the data cache has been cleared.
Listeners will be called with the following arguments:
|
Store | |
datachanged : ( Store this ) Fires when the data cache has changed, and a widget which is using this Store
as a Record cache should refresh its view.
Fires when the data cache has changed, and a widget which is using this Store
as a Record cache should refresh its view.
Listeners will be called with the following arguments:
|
Store | |
load : ( Store this , Ext.data.Record[] records , Object options ) Fires after a new set of Records has been loaded.
Fires after a new set of Records has been loaded.
Listeners will be called with the following arguments:
|
Store | |
loadexception : () Fires if an exception occurs in the Proxy during loading.
Called with the signature of the Proxy's "loadexception" ev...
Fires if an exception occurs in the Proxy during loading.
Called with the signature of the Proxy's "loadexception" event.
Listeners will be called with the following arguments:
|
Store | |
metachange : ( Store this , Object meta ) Fires when this store's reader provides new metadata (fields). This is currently only supported for JsonReaders.
Fires when this store's reader provides new metadata (fields). This is currently only supported for JsonReaders.
Listeners will be called with the following arguments:
|
Store | |
remove : ( Store this , Ext.data.Record record , Number index ) Fires when a Record has been removed from the Store
Fires when a Record has been removed from the Store
Listeners will be called with the following arguments:
|
Store | |
update : ( Store this , Ext.data.Record record , String operation ) Fires when a Record has been updated
Fires when a Record has been updated
Listeners will be called with the following arguments:
|
Store |