| java.lang.Object com.gwtext.client.core.JsObject com.gwtext.client.data.Store
All known Subclasses: com.gwtext.client.data.JsonStore, com.gwtext.client.data.SimpleStore, com.gwtext.client.data.GroupingStore,
Store | public class Store extends JsObject (Code) | | The Store class encapsulates a client side cache of
Record objects which provide input data for widgets such
as the
com.gwtext.client.widgets.grid.GridPanel , or the
com.gwtext.client.widgets.form.ComboBox .
A Store object uses an implementation of
DataProxy to access a data object unless you call loadData() directly
and pass in your data. The Store object has no knowledge of the format of the data returned by the Proxy.
A Store object uses its configured implementation of
Reader to
Record instances from the data object.
These records are cached and made available through accessor functions. Usage :
Object[][] states = new Object[][]{
new Object[]{"AL", "Alabama"},
new Object[]{"AK", "Alaska"},
new Object[]{"AZ", "Arizona"},
new Object[]{"AR", "Arkansas"},
new Object[]{"CA", "California"}};
Reader reader = new ArrayReader(new RecordDef(
new FieldDef[]{
new StringFieldDef("abbr"),
new StringFieldDef("state")
}));
Store store = new Store(proxy, reader);
See Also: com.gwtext.client.data.XmlReader See Also: com.gwtext.client.data.JsonReader See Also: com.gwtext.client.data.HttpProxy See Also: com.gwtext.client.data.MemoryProxy |
Field Summary | |
protected JavaScriptObject | configJS |
Method Summary | |
native public void | add(Record record) Add a Record to the Store and fires the add event. | public void | add(Record[] records) Add Records to the Store and fires the add event. | native public void | addSorted(Record record) (Local sort only) Inserts the passed the record in the Store at the index where it should go based on the
current sort information. | native public void | addStoreListener(StoreListener listener) Add a Store listener. | native public void | clearFilter() Revert to a view of the Record cache / snapshot with no filtering applied. | native public void | clearFilter(boolean suppressEvent) Revert to a view of the Record cache with no filtering applied. | native public void | commitChanges() Commit all Records with outstanding changes. | native JavaScriptObject | create(JavaScriptObject config) | native public void | each(StoreTraversalCallback cb) Calls the specified function for each of the Records in the cache. | native public void | filter(String field, RegExp regexp) Filter the records by a specified property using a Regular expression. | native public void | filter(String field, String value) Filter the records by a specified property . | native public void | filter(String field, String value, boolean anyMatch) Filter the records by a specified property . | native public void | filterBy(StoreTraversalCallback cb) Filter by a function. | native public Record | getAt(int index) Returns the record at the specified index. | public UrlParam[] | getBaseParams() Return the base params. | native public Record | getById(String id) Get the Record with the specified id. | native public int | getCount() Gets the number of cached records. | public JavaScriptObject | getJsObj() | public Record[] | getModifiedRecords() Gets all records modified since the last commit. | public Record[] | getRange(int startIndex, int endIndex) Returns a range of Records between specified indices. | public Record | getRecordAt(int index) Returns the record at the specified index. | public Record[] | getRecords() Return all the Records in the Store. | public SortState | getSortState() Returns the sort state of the Store. | native public int | getTotalCount() Gets the total number of records in the dataset as returned by the server. | native public int | indexOf(Record record) Get the index within the cache of the passed Record.
Parameters: record - the Record to find the index of the passed Record. | native public int | indexOfId(String id) Get the index within the cache of the Record with the passed id.
Parameters: id - the Record ID the index of the Record. | native public void | insert(int index, Record record) Inserts Records to the Store at the given index and fires the add event. | public void | insert(int index, Record[] records) Inserts Records to the Store at the given index and fires the add event. | native public void | load() 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
to establish the initial position within the dataset by calling
Store.load(int,int) , and the number of Records
to cache on each read from the Proxy. | native public void | load(int start, int limit) 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
to establish the initial position within the dataset by calling
Store.load(int,int) , and the number of Records
to cache on each read from the Proxy. | public void | load(UrlParam[] params) 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
to establish the initial position within the dataset by calling
Store.load(int,int) , and the number of Records
to cache on each read from the Proxy. | public void | load(UrlParam[] params, boolean add) 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
to establish the initial position within the dataset by calling
Store.load(int,int) , and the number of Records
to cache on each read from the Proxy. | native public void | loadJsonData(String jsonString, boolean append) | native public void | loadXmlData(String xmlString, boolean append) Load data from a local XML String. | native public void | loadXmlDataFromUrl(String url, boolean append) Load data from XML returned from a URL. | public Record[] | query(String field, String value) Query the records by a specified property. | public Record[] | query(String field, String value, boolean anyMatch) Query the records by a specified property. | public Record[] | query(String field, RegExp regexp) Query the records by a specified property. | public Record[] | queryBy(StoreQueryFunction queryFunction) Query by a function. | native public void | rejectChanges() Cancel outstanding changes on all changed records. | native public void | reload() Reloads the Record cache from the configured Proxy using the configured Reader and the options
from the last load operation performed. | public void | reload(UrlParam[] params) Reloads the Record cache from the configured Proxy using the configured Reader and the options
from the last load operation performed. | public void | reload(UrlParam[] params, boolean add) Reloads the Record cache from the configured Proxy using the configured Reader and the options
from the last load operation performed. | native public void | remove(Record record) Remove a Record from the Store and fires the remove event. | native public void | removeAll() Remove all Records from the Store and fires the clear event. | public void | setAutoLoad(boolean autoLoad) If true, this store's load method is automatically called after creation. | public void | setBaseParams(UrlParam[] baseParams) Url params which are to be sent as parameters on any HTTP request. | public void | setDataProxy(DataProxy proxy) The Proxy object which provides access to a data object.. | public void | setDefaultSort(String field, SortDir sortDir) Sets the default sort column and order to be used by the next load operation. | native public void | setDefaultSort(String field, String sortDir) Sets the default sort column and order to be used by the next load operation. | public void | setInitialSortState(SortState initialSortState) Set the initial sort state. | public void | setPruneModifiedRecords(boolean pruneModifiedRecords) True to clear all modified record information each time the store is loaded or when a record is removed. | public void | setReader(Reader reader) 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. | public void | setRecordDef(RecordDef recordDef) Sets the record def for the Store. | public void | setRemoteSort(boolean remoteSort) 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). | public void | setSortInfo(SortState sortInfo) | public void | setStoreId(String storeId) If passed, the id to use to register with the StoreMgr. | public void | setUrl(String url) If passed, an HttpProxy is created for the passed URL. | native public void | sort(String field) Sort the Records. | public void | sort(String field, SortDir direction) Sort the Records. | native public void | sort(String field, String direction) Sort the Records. | native public float | sum(String field) Sums the value of property for each record between start and end and returns the result. | native public float | sum(String field, int startIndex, int endIndex) Sums the value of property for each record between start and end and returns the result. |
configJS | protected JavaScriptObject configJS(Code) | | |
Store | public Store(JavaScriptObject jsObj)(Code) | | |
Store | public Store(Reader reader)(Code) | | Create a Store using the specified
Reader .
Parameters: reader - the reader |
Store | public Store(DataProxy dataProxy, Reader reader, UrlParam[] baseParams, SortState initialSortState, boolean remoteSort)(Code) | | Create a Store using the specified configuration.
Parameters: dataProxy - the data proxy Parameters: reader - the reader Parameters: baseParams - base params which are to be sent as parameters on any HTTP request. Used only for Http based proxies. Parameters: initialSortState - the initial sort field name and direction Parameters: remoteSort - true to enable remote sort |
add | native public void add(Record record)(Code) | | Add a Record to the Store and fires the add event.
Parameters: record - the Record to add |
add | public void add(Record[] records)(Code) | | Add Records to the Store and fires the add event.
Parameters: records - the Records to add |
addSorted | native public void addSorted(Record record)(Code) | | (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: record - the record to add |
addStoreListener | native public void addStoreListener(StoreListener listener)(Code) | | Add a Store listener.
Parameters: listener - the listener |
clearFilter | native public void clearFilter()(Code) | | Revert to a view of the Record cache / snapshot with no filtering applied. A snapshot of the data is taken when
Store.filter(String,String) is called.
Records added to the Store after filter is caleld will be lost if clearFilter is subsequently called.
|
clearFilter | native public void clearFilter(boolean suppressEvent)(Code) | | Revert to a view of the Record cache with no filtering applied.
Parameters: suppressEvent - if true the filter is cleared silently without notifying listeners |
commitChanges | native public void commitChanges()(Code) | | 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
Record.COMMIT .
|
create | native JavaScriptObject create(JavaScriptObject config)(Code) | | |
each | native public void each(StoreTraversalCallback cb)(Code) | | Calls the specified function for each of the Records in the cache.
Parameters: cb - the Store traversal callback |
filter | native public void filter(String field, RegExp regexp)(Code) | | Filter the records by a specified property using a Regular expression.
Parameters: field - the filed to filter on Parameters: regexp - the regular expression to test field value against |
filter | native public void filter(String field, String value)(Code) | | Filter the records by a specified property .
Parameters: field - the filed to filter on Parameters: value - a string that the field should start with |
filter | native public void filter(String field, String value, boolean anyMatch)(Code) | | Filter the records by a specified property .
Parameters: field - the filed to filter on Parameters: value - a string that the field should start with Parameters: anyMatch - true to match any part not just the beginning |
filterBy | native public void filterBy(StoreTraversalCallback cb)(Code) | | Filter by a function. The specified function will be called with each record in this data source. If the function returns
true the record is included, otherwise it is filtered.
Parameters: cb - the filter function |
getAt | native public Record getAt(int index)(Code) | | Returns the record at the specified index.
Parameters: index - the Store index the Record at index |
getBaseParams | public UrlParam[] getBaseParams()(Code) | | Return the base params.
the base params |
getById | native public Record getById(String id)(Code) | | Get the Record with the specified id.
Parameters: id - the Record ID the matched Record or null if no match found |
getCount | native public int getCount()(Code) | | 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 data set size
the Record count |
getJsObj | public JavaScriptObject getJsObj()(Code) | | |
getModifiedRecords | public Record[] getModifiedRecords()(Code) | | Gets all records modified since the last commit. Modified records are persisted across load operations (e.g., during paging).
the modified Records. Returns an empty array if no records were modified |
getRange | public Record[] getRange(int startIndex, int endIndex)(Code) | | Returns a range of Records between specified indices.
Parameters: startIndex - the starting index (0 based) Parameters: endIndex - the ending index array of Records |
getRecordAt | public Record getRecordAt(int index)(Code) | | Returns the record at the specified index. This method is functionally equivalent to
Store.getAt(int) .
Parameters: index - the Store index the Record at index |
getRecords | public Record[] getRecords()(Code) | | Return all the Records in the Store.
the Records |
getSortState | public SortState getSortState()(Code) | | Returns the sort state of the Store.
the Store sort state |
getTotalCount | native public int getTotalCount()(Code) | | 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.
total record count |
indexOf | native public int indexOf(Record record)(Code) | | Get the index within the cache of the passed Record.
Parameters: record - the Record to find the index of the passed Record. Returns -1 if not found |
indexOfId | native public int indexOfId(String id)(Code) | | Get the index within the cache of the Record with the passed id.
Parameters: id - the Record ID the index of the Record. Returns -1 if not found |
insert | native public void insert(int index, Record record)(Code) | | Inserts Records to the Store at the given index and fires the add event.
Parameters: index - the start index at which to insert the passed Record Parameters: record - the Record to insert |
insert | public void insert(int index, Record[] records)(Code) | | Inserts Records to the Store at the given index and fires the add event.
Parameters: index - the start index at which to insert the passed Records Parameters: records - the Records to insert |
load | native public void load()(Code) | | 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
to establish the initial position within the dataset by calling
Store.load(int,int) , 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 "load" event handler.
|
load | native public void load(int start, int limit)(Code) | | 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
to establish the initial position within the dataset by calling
Store.load(int,int) , 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 "load" event handler.
Parameters: start - start position Parameters: limit - limit |
load | public void load(UrlParam[] params)(Code) | | 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
to establish the initial position within the dataset by calling
Store.load(int,int) , 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 "load" event handler.
Parameters: params - the load params |
load | public void load(UrlParam[] params, boolean add)(Code) | | 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
to establish the initial position within the dataset by calling
Store.load(int,int) , 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 "load" event handler.
Parameters: params - the load params Parameters: add - true to append loaded records rather than replace the current cache |
loadJsonData | native public void loadJsonData(String jsonString, boolean append)(Code) | | Load data from a local Json String
Parameters: jsonString - the Json String Parameters: append - true to append to the Store |
loadXmlData | native public void loadXmlData(String xmlString, boolean append)(Code) | | Load data from a local XML String.
Parameters: xmlString - the XML data Parameters: append - true to append records |
loadXmlDataFromUrl | native public void loadXmlDataFromUrl(String url, boolean append)(Code) | | Load data from XML returned from a URL.
Parameters: url - the url that returns the XML data Parameters: append - true to append records |
query | public Record[] query(String field, String value)(Code) | | Query the records by a specified property.
Parameters: field - the field to query on Parameters: value - a string that the field should start with array of match records or empty array if no match found |
query | public Record[] query(String field, String value, boolean anyMatch)(Code) | | Query the records by a specified property.
Parameters: field - the field to query on Parameters: value - a string that the field should start with Parameters: anyMatch - true to match any part not just the beginning array of match records or empty array if no match found |
query | public Record[] query(String field, RegExp regexp)(Code) | | Query the records by a specified property.
Parameters: field - the field to query on Parameters: regexp - a RegExp to test against the field array of match records or empty array if no match found |
queryBy | public Record[] queryBy(StoreQueryFunction queryFunction)(Code) | | Query by a function. The specified function will be called with each record in this data source.
If the function returns true the record is included in the results.
Parameters: queryFunction - the query function array of match records or empty array if no match found |
rejectChanges | native public void rejectChanges()(Code) | | Cancel outstanding changes on all changed records.
|
reload | native public void reload()(Code) | | Reloads the Record cache from the configured Proxy using the configured Reader and the options
from the last load operation performed.
|
reload | public void reload(UrlParam[] params)(Code) | | Reloads the Record cache from the configured Proxy using the configured Reader and the options
from the last load operation performed.
Parameters: params - the request params |
reload | public void reload(UrlParam[] params, boolean add)(Code) | | Reloads the Record cache from the configured Proxy using the configured Reader and the options
from the last load operation performed.
Parameters: params - the request params Parameters: add - true to append loaded records rather than replace the current cache |
remove | native public void remove(Record record)(Code) | | Remove a Record from the Store and fires the remove event.
Parameters: record - the record to remove |
removeAll | native public void removeAll()(Code) | | Remove all Records from the Store and fires the clear event.
|
setAutoLoad | public void setAutoLoad(boolean autoLoad)(Code) | | If true, this store's load method is automatically called after creation.
Parameters: autoLoad - true to auto laod |
setBaseParams | public void setBaseParams(UrlParam[] baseParams)(Code) | | Url params which are to be sent as parameters on any HTTP request.
Parameters: baseParams - the base params |
setDataProxy | public void setDataProxy(DataProxy proxy)(Code) | | The Proxy object which provides access to a data object..
Parameters: proxy - the data proxy |
setDefaultSort | public void setDefaultSort(String field, SortDir sortDir)(Code) | | Sets the default sort column and order to be used by the next load operation.
Parameters: field - the name of the field to sort by Parameters: sortDir - the sort order |
setInitialSortState | public void setInitialSortState(SortState initialSortState)(Code) | | Set the initial sort state.
Parameters: initialSortState - the initial sort state |
setPruneModifiedRecords | public void setPruneModifiedRecords(boolean pruneModifiedRecords)(Code) | | True to clear all modified record information each time the store is loaded or when a record is removed. (defaults to false).
Parameters: pruneModifiedRecords - true to prune modified records |
setReader | public void setReader(Reader reader)(Code) | | 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.
Parameters: reader - the reader |
setRecordDef | public void setRecordDef(RecordDef recordDef)(Code) | | Sets the record def for the Store.
Parameters: recordDef - the stores record def |
setRemoteSort | public void setRemoteSort(boolean remoteSort)(Code) | | 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:
sort : String The name (as specified in the Record's Field definition) of the field to sort on.
dir : String The direction of the sort, "ASC" or "DESC".
Parameters: remoteSort - true to enable remote sort |
setSortInfo | public void setSortInfo(SortState sortInfo)(Code) | | The initial field to sort and its direction
Parameters: sortInfo - the sort info |
setStoreId | public void setStoreId(String storeId)(Code) | | If passed, the id to use to register with the StoreMgr.
Parameters: storeId - the store ID |
setUrl | public void setUrl(String url)(Code) | | If passed, an HttpProxy is created for the passed URL.
Parameters: url - the url |
sort | native public void sort(String field)(Code) | | 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: field - the name of the field to sort by |
sort | public void sort(String field, SortDir direction)(Code) | | 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: field - the name of the field to sort by Parameters: direction - the sort order |
sort | native public void sort(String field, String direction)(Code) | | 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: field - the name of the field to sort by Parameters: direction - the sort order, "ASC" or "DESC" (defaults to "ASC")Store.sort(String,com.gwtext.client.core.SortDir) |
sum | native public float sum(String field)(Code) | | Sums the value of property for each record between start and end and returns the result.
Parameters: field - field on your records the sum |
sum | native public float sum(String field, int startIndex, int endIndex)(Code) | | Sums the value of property for each record between start and end and returns the result.
Parameters: field - field on your records Parameters: startIndex - the record index to start at (defaults to 0) Parameters: endIndex - the last record index to include the sum |
Fields inherited from com.gwtext.client.core.JsObject | protected JavaScriptObject jsObj(Code)(Java Doc)
|
|
|