X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..ddde20c4d4ac6a8d53de079761155de813845b3c:/docs/output/Ext.data.DirectStore.html diff --git a/docs/output/Ext.data.DirectStore.html b/docs/output/Ext.data.DirectStore.html index 526116fd..62ac4840 100644 --- a/docs/output/Ext.data.DirectStore.html +++ b/docs/output/Ext.data.DirectStore.html @@ -1,25 +1,25 @@ -
Observable Store DirectStore
Package: | Ext.data |
Defined In: | DirectStore.js |
Class: | DirectStore |
Extends: | Store |
xtype: | directstore |
Small helper class to create an Ext.data.Store configured with an -Ext.data.DirectProxy and Ext.data.JsonReader to make interacting -with an Ext.Direct Server-side Provider easier. -To create a different proxy/reader combination create a basic Ext.data.Store -configured as needed.
-*Note: Although they are not listed, this class inherits all of the config options of:
-Observable Store DirectStore
Package: | Ext.data |
Defined In: | DirectStore.js |
Class: | DirectStore |
Extends: | Store |
Small helper class to create an Ext.data.Store configured with an +Ext.data.DirectProxy and Ext.data.JsonReader to make interacting +with an Ext.Direct Server-side Provider easier. +To create a different proxy/reader combination create a basic Ext.data.Store +configured as needed.
+*Note: Although they are not listed, this class inherits all of the config options of:
+Config Options | Defined By | |
---|---|---|
autoDestroy : Boolean true to destroy the store when the component the store is bound
to is destroyed (defaults to false).
Note: this shoul... true to destroy the store when the component the store is bound
@@ -186,10 +186,13 @@ for a description of this property.
To modify this property see setBasePar... See the corresponding configuration option
for a description of this property.
To modify this property see setBaseParam . | Store | |
fields : Ext.util.MixedCollection | Store | |
lastOptions : Object Contains the last options object used as the parameter to the load method. See load
+for the Records stored in this Store. Read-only. | Store | |
hasMultiSort : Boolean +True if this store is currently sorted by more than one field/direction combination. | Store | |
isDestroyed : Boolean +True if the store has been destroyed already. Read only | 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 ... | Store | |
recordType : Function The Record constructor as supplied to (or created by) the
+to load the current Record cache. | Store | |
multiSortInfo : Object +Object containing overall sort direction and an ordered array of sorter configs used when sorting on multiple fields | Store | |
recordType : Function The Record constructor as supplied to (or created by) the
Reader. Read-only.
If the Reader was constructed by passing... The Record constructor as supplied to (or created by) the
Reader. Read-only.
@@ -197,67 +200,69 @@ If the Reader was constructed by passing... The Ext.data.Record.create for additional details).
This property may be used to create new Records of the type held in this Store, for example:
| Store |
Method | Defined By | |||
---|---|---|---|---|
DirectStore( Object config )
- Parameters:
| DirectStore | |||
add( Ext.data.Record[] records )
+ // create the Grid
+ var grid = new Ext.grid.EditorGridPanel({
+ store: store,
+ colModel: new Ext.grid.ColumnModel({
+ columns: [
+ {id:'company', header: 'Company', width: 160, dataIndex: 'company'},
+ {header: 'Price', renderer: 'usMoney', dataIndex: 'price'},
+ {header: 'Change', renderer: change, dataIndex: 'change'},
+ {header: '% Change', renderer: pctChange, dataIndex: 'pctChange'},
+ {header: 'Last Updated', width: 85,
+ renderer: Ext.util.Format.dateRenderer('m/d/Y'),
+ dataIndex: 'lastChange'}
+ ],
+ defaults: {
+ sortable: true,
+ width: 75
+ }
+ }),
+ autoExpandColumn: 'company', // match the id specified in the column model
+ height:350,
+ width:600,
+ title:'Array Grid',
+ tbar: [{
+ text: 'Add Record',
+ handler : function(){
+ var defaultData = {
+ change: 0,
+ company: 'New Company',
+ lastChange: (new Date()).clearTime(),
+ pctChange: 0,
+ price: 10
+ };
+ var recId = 3; // provide unique id
+ var p = new store.recordType(defaultData, recId); // create new record
+ grid.stopEditing();
+ store.insert(0, p); // insert a new record into the store (also see add)
+ grid.startEditing(0, 0);
+ }
+ }]
+ }); | Store |
Method | Defined By | ||
---|---|---|---|
DirectStore( Object config )
+ Parameters:
| DirectStore | ||
add( Ext.data.Record[] records )
:
voidAdd Records to the Store and fires the add event. To add Records
to the store from a remote source use load({add:tru... Add Records to the Store and fires the add event. To add Records
to the store from a remote source use load({add:true}) .
See also recordType and insert .Parameters:
| Store | ||
addEvents( Object object )
+to add to the cache. See recordType.Returns:
| Store | ||
addEvents( Object|String o , string Optional. )
:
- voidUsed to define events on this Observable Used to define events on this Observable Parameters:
| Observable | ||
addListener( String eventName , Function handler , [Object scope ], [Object options ] )
+ 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 | ||
addSorted( Ext.data.Record record )
:
void(Local sort only) Inserts the passed Record into the Store at the index where it
@@ -322,17 +327,76 @@ should go based on the current sort information. Commit all Records with outstanding changes. To handle updates for changes,
subscribe to the Store's update event, an... 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 | ||
destroy()
+Ext.data.Record.COMMIT. Parameters:
| Store | ||
createMultipleFilterFn( Array filters )
:
- voidDestroys the store. Destroys the store. Parameters:
| Store | ||
each( Function fn , [Object scope ] )
+ FunctionGiven an array of filter functions (each with optional scope), constructs and returns a single function that returns
+... Given an array of filter functions (each with optional scope), constructs and returns a single function that returns
+the result of all of the filters ANDed together Parameters:
| Store | ||
createSortFunction( String field , String direction )
:
- voidCalls the specified function for each of the Records in the cache. Calls the specified function for each of the Records in the cache. | Store | ||
enableBubble( Object events )
+ FunctionCreates and returns a function which sorts an array by the given field and direction Creates and returns a function which sorts an array by the given field and direction Parameters:
| Store | ||
destroy()
:
- void Used to enable bubbling of events Used to enable bubbling of events Parameters:
| Observable | ||
filter( String field , String/RegExp value , [Boolean anyMatch ], [Boolean caseSensitive ] )
+ voidDestroys the store. Destroys the store. Parameters:
| Store | ||
each( Function fn , [Object scope ] )
:
- voidFilter the records by a specified property. Filter the records by a specified property. Parameters:
| Store | ||
filterBy( Function fn , [Object scope ] )
+ voidCalls the specified function for each of the Records in the cache. Calls the specified function for each of the Records in the cache. | Store | ||
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 | ||
filter( String|Array field , String/RegExp value , [Boolean anyMatch ], [Boolean caseSensitive ], Boolean exactMatch )
+ :
+ voidFilter the records by a specified property. Alternatively, pass an array of filter
+options to filter by more than one... Filter the records by a specified property. Alternatively, pass an array of filter
+options to filter by more than one property.
+Single filter example:
+store.filter('name', 'Ed', true, true); //finds all records containing the substring 'Ed'
+Multiple filter example:
+store.filter([
+{
+property : 'name',
+value : 'Ed',
+anyMatch : true, //optional, defaults to true
+caseSensitive: true //optional, defaults to true
+},
+//filter functions can also be passed
+{
+fn : function(record) {
+return record.get('age') == 24
+},
+scope: this
+}
+]); Parameters:
| Store | ||
filterBy( Function fn , [Object scope ] )
:
voidFilter 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
@@ -341,10 +405,10 @@ otherwise it is filtered out. Parameters:record : Ext.data.Record The record to test for filtering. Access field values using Ext.data.Record.get. The ID of the Record passed. scope : Object(optional) The scope of the function (defaults to this)
| Store | ||
find( String property , String/RegExp value , [Number startIndex ], [Boolean anyMatch ], [Boolean caseSensitive ] )
+scope : Object(optional) The scope ( this reference) in which the function is executed. Defaults to this Store.
| Store | ||
find( String fieldName , String/RegExp value , [Number startIndex ], [Boolean anyMatch ], [Boolean caseSensitive ] )
:
- NumberFinds 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 ] )
+ NumberFinds the index of the first matching Record in this store by a specific field value. Finds the index of the first matching Record in this store by a specific field value. Parameters:
| Store | ||
findBy( Function fn , [Object scope ], [Number startIndex ] )
:
NumberFind 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.
@@ -352,9 +416,9 @@ If the function returns true it is considered a match. The record
to test for filtering. Access field values using Ext.data.Record.get.
The ID of the Record passed. scope : Object(optional) The scope of the function (defaults to this) startIndex : Number(optional) The index to start searching at
| Store | ||
findExact( String property , String/RegExp value , [Number startIndex ] )
+scope : Object(optional) The scope ( this reference) in which the function is executed. Defaults to this Store.startIndex : Number(optional) The index to start searching at
| Store | ||
findExact( String fieldName , Mixed value , [Number startIndex ] )
:
- NumberFinds 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 | ||
fireEvent( String eventName , Object... args )
+ NumberFinds the index of the first matching Record in this store by a specific field value. Finds the index of the first matching Record in this store by a specific field value. Parameters:
| Store | ||
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). @@ -427,14 +491,14 @@ will be automatically included with the posted parameters according to the speci parameters to a remote data source. Note:params will override any
baseParams of the same name.
Parameters are encoded as standard HTTP parameters using Ext.urlEncode. A function to be called after the Records -have been loaded. The callback is called after the load event and is passed the following arguments:
Scope with which to call the callback (defaults + A function to be called after the Records +have been loaded. The callback is called after the load event is fired, and is passed the following arguments:
Scope with which to call the callback (defaults to the Store object) Indicator to append loaded records rather than + Indicator to append loaded records rather than replace the current cache. Note: see note for loadData
| Store | ||
loadData( Object data , [Boolean append ] )
@@ -447,7 +511,13 @@ that Reader'
the existing cache.
Note: that Records in a Store are keyed by their id, so added Records
with ids which are already present in the Store will replace existing Records. Only Records with
-new, unique ids will be added.Returns:
| Store | ||
on( String eventName , Function handler , [Object scope ], [Object options ] )
+new, unique ids will be added.Returns:
| Store | ||
multiSort( Array sorters , String direction )
+ :
+ voidSorts the contents of this store by multiple field/direction sorters. This is called internally by sort
+and would not... Sorts the contents of this store by multiple field/direction sorters. This is called internally by sort
+and would not usually be called manually.
+Multi sorting only currently applies to local datasets - multiple sort data is not currently sent to a proxy
+if remoteSort is used. Parameters:
| Store | ||
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 | ||
purgeListeners()
@@ -464,22 +534,30 @@ included in the results. Parameters:
The record to test for filtering. Access field values using Ext.data.Record.get. The ID of the Record passed. scope : Object(optional) The scope of the function (defaults to this)
| Store | ||
rejectChanges()
+scope : Object(optional) The scope ( this reference) in which the function is executed. Defaults to this Store.
| Store | ||
rejectChanges()
:
void Reject outstanding changes on all modified records. | Store | ||
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 | ||
reload( [Object options ] )
- :
- voidReloads 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. -Note: see the Important note in load. Parameters:
| Store | ||
remove( Ext.data.Record record )
+ 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 | ||
reload( Object options )
+ :
+ voidReloads 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. +Note: see the Important note in load. Parameters:
| Store | ||
remove( Ext.data.Record/Ext.data.Record[] record )
:
- voidRemove 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 Records from the Store and fires the remove event. Remove Records from the Store and fires the remove event. Parameters:
| Store | ||
removeAll( Boolean silent )
:
- voidRemove all Records from the Store and fires the clear event. Remove all Records from the Store and fires the clear event. Parameters:
| Store | ||
removeAt( Number index )
+ voidRemove all Records from the Store and fires the clear event. Remove all Records from the Store and fires the clear event. Parameters:
| Store | ||
removeAt( Number index )
:
voidRemove a Record from the Store at the specified index. Fires the remove event. Remove a Record from the Store at the specified index. Fires the remove event. Parameters:
| Store | ||
removeListener( String eventName , Function handler , [Object scope ] )
:
@@ -491,7 +569,7 @@ event...Resume firing events. (see Parameters:
| Observable | ||
save()
:
- void Saves all pending changes to the store. If the commensurate Ext.data.Api.actions action is not configured, then
+ Number Saves all pending changes to the store. If the commensurate Ext.data.Api.actions action is not configured, then
the ... Saves all pending changes to the store. If the commensurate Ext.data.Api.actions action is not configured, then
the configured url will be used.
@@ -500,16 +578,39 @@ change url removed records Ext.data.Api.actions.destroy phantom records Ext.data.Api.actions.create modified records Ext.data.Api.actions.update - Parameters:
| Store | ||
setBaseParam( String name , Mixed value )
+Parameters:
| Store | ||
setBaseParam( String name , Mixed value )
:
voidSet the value for a property name in this store's baseParams. Usage:myStore.setBaseParam('foo', {bar:3}); Set the value for a property name in this store's baseParams. Usage:
Parameters:
| Store | ||
setDefaultSort( String fieldName , [String dir ] )
:
- voidSets 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 ] )
+ voidSets 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 | ||
singleSort( String fieldName , [String dir ] )
+ :
+ voidSorts the store contents by a single field and direction. This is called internally by sort and would
+not usually be ... Sorts the store contents by a single field and direction. This is called internally by sort and would
+not usually be called manually Parameters:
| Store | ||
sort( String/Array fieldName , [String dir ] )
:
voidSort 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. See also remoteSort and paramNames. Parameters:
| Store | ||
sum( String property , [Number start ], [Number end ] )
+sorting is used, the cache is sorted internally. See also remoteSort and paramNames.
+This function accepts two call signatures - pass in a field name as the first argument to sort on a single
+field, or pass in an array of sort configuration objects to sort by multiple fields.
+Single sort example:
+store.sort('name', 'ASC');
+Multi sort example:
+store.sort([
+{
+field : 'name',
+direction: 'ASC'
+},
+{
+field : 'salary',
+direction: 'DESC'
+}
+], 'ASC');
+In this second form, the sort configs are applied in order, with later sorters sorting within earlier sorters' results.
+For example, if two records with the same name are present they will also be sorted by salary if given the sort configs
+above. Any number of sort configs can be added.Parameters:
| Store | ||
sum( String property , [Number start ], [Number end ] )
:
NumberSums 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
@@ -524,11 +625,14 @@ after the Fires before a request is made for a new data object. If the beforeload handler returns
false the load action will b... | Store | ||
beforewrite :
- ( DataProxy this , String action , Record/Array[Record] rs , Object options , Object arg )
- 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 :
+false the load action will be canceled. Listeners will be called with the following arguments:
| Store | ||
beforesave :
+ ( Ext.data.Store store , Object data )
+ Fires before a save action is called. A save encompasses destroying records, updating records and creating records. Fires before a save action is called. A save encompasses destroying records, updating records and creating records. Listeners will be called with the following arguments:
| Store | ||
beforewrite :
+ ( Ext.data.Store store , String action , Record/Record[] rs , Object options , Object arg )
+ Listeners will be called with the following arguments:
| Store | ||
clear :
+ ( Store this , Record[] The )
+ 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 in a bulk manner (e.g., it has been sorted, filtered, etc.) and a
widget that i... Fires when the data cache has changed in a bulk manner (e.g., it has been sorted, filtered, etc.) and a
@@ -554,15 +658,17 @@ for description. | 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 :
+ 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 | ||
save :
+ ( Ext.data.Store store , Number batch , Object data )
+ Fires after a save is completed. A save encompasses destroying records, updating records and creating records. Fires after a save is completed. A save encompasses destroying records, updating records and creating records. 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 | ||
write : + Ext.data.Record.REJECT + Ext.data.Record.COMMIT | Store | ||
write :
( Ext.data.Store store , String action , Object result , Ext.Direct.Transaction res , Record/Record[] rs )
Fires if the server returns 200 after an Ext.data.Api.actions CRUD action.
-Success or failure of the action is availa... Fires if the server returns 200 after an Ext.data.Api.actions CRUD action.
-Success or failure of the action is available in the result['successProperty'] property.
-The server-code might set the successProperty to false if a database validation
-failed, for example.Listeners will be called with the following arguments:
| Store |
result['successProperty']
property (NOTE for RESTful stores,
+a simple 20x response is sufficient for the actions "destroy" and "update". The "create" action should should return 200 along with a database pk).store
: Ext.data.Storeaction
: Stringresult
: Objectres
: Ext.Direct.Transactionrs
: Record/Record[]