Class type Ext_data_Store.t


class type t = object .. end
Inherits
method currentPage : Js.number Js.t Js.prop

The page that the Store has most recently loaded (see loadPage)

Defaults to: 1

method data : 'a. 'a Js.t Js.prop

When this Store is not buffered, the data property is a MixedCollection which holds this store's local cache of records.

When this store is buffered, the data property is a cache of pages of records used to satisfy load requests from the Store when the associated view scrolls. Depending on how the buffer zone and purgePageCount are configured, pages which are scrolled out of view may be evicted from the cache, and need to be re-requested from the server when scrolled back into view. For this reason, if using buffered, it is recommended that you configure your Model definitions with a unique Ext.data.Model.idProperty so that records which return to the page cache may be matched against previously selected records.

Pages in the direction of scroll are prefetched from the remote server and loaded into this cache before they are needed based upon the buffer zone so that scrolling can proceed without visible pauses for data loading.


method snapshot : Ext_util_MixedCollection.t Js.t Js.prop

A pristine (unfiltered) collection of the records in this store. This is used to reinstate records when a filter is removed or changed


method add : 'b. 'b Js.t -> Ext_data_Model.t Js.js_array Js.t Js.meth

Adds Model instance to the Store. This method accepts either:

The new Model instances will be added at the end of the existing collection.

Sample usage:

myStore.add({some: 'data'}, {some: 'other data'});

Note that if this Store is sorted, the new Model instances will be inserted at the correct point in the Store to maintain the sort order.

Parameters:

Returns:


method addFilter : 'c. 'c Js.t -> bool Js.t Js.optdef -> unit Js.meth

Adds a new Filter to this Store's filter set and by default, applys the updated filter set to the Store's unfiltered dataset.

Parameters:


method addSorted : Ext_data_Model.t Js.t -> unit Js.meth

(Local sort only) Inserts the passed Record into the Store at the index where it should go based on the current sort information.

Parameters:


method aggregate : 'd 'e 'f 'g.
'd Js.callback ->
'e Js.t Js.optdef ->
bool Js.t Js.optdef -> 'f Js.js_array Js.t Js.optdef -> 'g Js.t Js.meth

Runs the aggregate function for all the records in the store.

When store is filtered, only items within the filter are aggregated.

Parameters:

Returns:


method average : 'h. Js.js_string Js.t -> bool Js.t Js.optdef -> 'h Js.t Js.meth

Gets the average value in the store.

When store is filtered, only items within the filter are aggregated.

Parameters:

Returns:


method clearFilter : bool Js.t Js.optdef -> unit Js.meth

Reverts to a view of the Record cache with no filtering applied.

Parameters:


method clearGrouping : unit Js.meth

Clear any groupers in the store


method collect : 'i.
Js.js_string Js.t ->
bool Js.t Js.optdef ->
bool Js.t Js.optdef -> 'i Js.t Js.js_array Js.t Js.meth

Collects unique values for a particular dataIndex from this store.

Parameters:

Returns:


method commitChanges : unit Js.meth

Commits 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.


method count : bool Js.t Js.optdef -> Js.number Js.t Js.meth

Gets the count of items in the store.

When store is filtered, only items within the filter are counted.

Parameters:

Returns:


method each : 'j 'k. 'j Js.callback -> 'k Js.t Js.optdef -> unit Js.meth

Calls the specified function for each record in the store.

When store is filtered, only loops over the filtered records.

Parameters:


method filter : 'l. 'l Js.t Js.optdef -> Js.js_string Js.t Js.optdef -> unit Js.meth

Filters the loaded set of records by a given set of filters.

By default, the passed filter(s) are added to the collection of filters being used to filter this Store.

To remove existing filters before applying a new set of filters use

// Clear the filter collection without updating the UI
store.clearFilter(true);

see clearFilter.

Alternatively, if filters are configured with an id, then existing filters store may be replaced by new filters having the same id.

Filtering by single field:

store.filter("email", /\.com$/);

Using multiple filters:

store.filter([
    {property: "email", value: /\.com$/},
    {filterFn: function(item) { return item.get("age") > 10; }}
]);

Using Ext.util.Filter instances instead of config objects (note that we need to specify the root config option in this case):

store.filter([
    Ext.create('Ext.util.Filter', {property: "email", value: /\.com$/, root: 'data'}),
    Ext.create('Ext.util.Filter', {filterFn: function(item) { return item.get("age") > 10; }, root: 'data'})
]);

When store is filtered, most of the methods for accessing store data will be working only within the set of filtered records. Two notable exceptions are queryBy and getById.

Parameters:


method filterBy : 'm 'n. 'm Js.callback -> 'n Js.t Js.optdef -> unit Js.meth

Filters 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.

When store is filtered, most of the methods for accessing store data will be working only within the set of filtered records. Two notable exceptions are queryBy and getById.

Parameters:


method find : 'o.
Js.js_string Js.t ->
'o Js.t ->
Js.number Js.t Js.optdef ->
bool Js.t Js.optdef ->
bool Js.t Js.optdef -> bool Js.t Js.optdef -> Js.number Js.t Js.meth

Finds the index of the first matching Record in this store by a specific field value.

When store is filtered, finds records only within filter.

**IMPORTANT

If this store is buffered, this can ONLY find records which happen to be cached in the page cache. This will be parts of the dataset around the currently visible zone, or recently visited zones if the pages have not yet been purged from the cache.**

Parameters:

Returns:


method findBy : 'p 'q.
'p Js.callback ->
'q Js.t Js.optdef -> Js.number Js.t Js.optdef -> Js.number Js.t Js.meth

Find the index of the first matching Record in this Store by a function. If the function returns true it is considered a match.

When store is filtered, finds records only within filter.

**IMPORTANT

If this store is buffered, this can ONLY find records which happen to be cached in the page cache. This will be parts of the dataset around the currently visible zone, or recently visited zones if the pages have not yet been purged from the cache.**

Parameters:

Returns:


method findExact : 'r.
Js.js_string Js.t ->
'r Js.t -> Js.number Js.t Js.optdef -> Js.number Js.t Js.meth

Finds the index of the first matching Record in this store by a specific field value.

When store is filtered, finds records only within filter.

**IMPORTANT

If this store is buffered, this can ONLY find records which happen to be cached in the page cache. This will be parts of the dataset around the currently visible zone, or recently visited zones if the pages have not yet been purged from the cache.**

Parameters:

Returns:


method findRecord : 's.
Js.js_string Js.t ->
's Js.t ->
Js.number Js.t Js.optdef ->
bool Js.t Js.optdef ->
bool Js.t Js.optdef -> bool Js.t Js.optdef -> Ext_data_Model.t Js.t Js.meth

Finds the first matching Record in this store by a specific field value.

When store is filtered, finds records only within filter.

**IMPORTANT

If this store is buffered, this can ONLY find records which happen to be cached in the page cache. This will be parts of the dataset around the currently visible zone, or recently visited zones if the pages have not yet been purged from the cache.**

Parameters:

Returns:


method first : 't. bool Js.t Js.optdef -> 't Js.t Js.meth

Convenience function for getting the first model instance in the store.

When store is filtered, will return first item within the filter.

Parameters:

Returns:


method getAt : Js.number Js.t -> Ext_data_Model.t Js.t Js.meth

Get the Record at the specified index.

The index is effected by filtering.

Parameters:

Returns:


method getById : 'u. 'u Js.t -> Ext_data_Model.t Js.t Js.meth

Get the Record with the specified id.

This method is not effected by filtering, lookup will be performed from all records inside the store, filtered or not.

Parameters:

Returns:


method getCount : Js.number Js.t Js.meth

Gets the number of records in store.

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. Note: see the Important note in load.

When store is filtered, it's the number of records matching the filter.

Returns:


method getGroupString : Ext_data_Model.t Js.t -> Js.js_string Js.t Js.meth

Returns the string to group on for a given model instance. The default implementation of this method returns the model's groupField, but this can be overridden to group by an arbitrary string. For example, to group by the first letter of a model's 'name' field, use the following code:

Ext.create('Ext.data.Store', {
    groupDir: 'ASC',
    getGroupString: function(instance) {
        return instance.get('name')[0];
    }
});

Parameters:

Returns:


method getGroups : 'v. Js.js_string Js.t Js.optdef -> 'v Js.t Js.meth

Returns an array containing the result of applying grouping to the records in this store. See groupField, groupDir and getGroupString. Example for a store containing records with a color field:

var myStore = Ext.create('Ext.data.Store', {
    groupField: 'color',
    groupDir  : 'DESC'
});

myStore.getGroups(); // returns:
[
    {
        name: 'yellow',
        children: [
            // all records where the color field is 'yellow'
        ]
    },
    {
        name: 'red',
        children: [
            // all records where the color field is 'red'
        ]
    }
]

Group contents are effected by filtering.

Parameters:

Returns:


method getNewRecords : Ext_data_Model.t Js.js_array Js.t Js.meth

inherit docs

Returns all Model instances that are either currently a phantom (e.g. have no id), or have an ID but have not yet been saved on this Store (this happens when adding a non-phantom record from another Store into this one)

Returns:


method getPageFromRecordIndex : Js.number Js.t -> Js.number Js.t Js.meth

Determines the page from a record index

Parameters:

Returns:


method getRange : 'w.
Js.number Js.t ->
Js.number Js.t ->
'w Js.t Js.optdef -> Ext_data_Model.t Js.js_array Js.t Js.meth

Gathers a range of Records between specified indices.

If this store is buffered, the indices are relative to the entire dataset, not the local record cache.

If this store is buffered, then the requested data range may not be immediately available, and will be returned through a passed callback function.

This method is affected by filtering.

Parameters:

Returns:


method getTotalCount : Js.number Js.t Js.meth

Returns the total number of Model instances that the Proxy indicates exist. This will usually differ from getCount when using paging - getCount returns the number of records loaded into the Store at the moment, getTotalCount returns the number of records that could be loaded into the Store if the Store contained all data

Returns:


method getUpdatedRecords : Ext_data_Model.t Js.js_array Js.t Js.meth

inherit docs

Returns all Model instances that have been updated in the Store but not yet synchronized with the Proxy

Returns:


method group : 'x. 'x Js.t -> Js.js_string Js.t Js.optdef -> unit Js.meth

Groups data inside the store.

Parameters:


method indexOf : Ext_data_Model.t Js.t -> Js.number Js.t Js.meth

Get the index of the record within the store.

When store is filtered, records outside of filter will not be found.

Parameters:

Returns:


method indexOfId : Js.js_string Js.t -> Js.number Js.t Js.meth

Get the index within the store of the Record with the passed id.

Like indexOf, this method is effected by filtering.

Parameters:

Returns:


method indexOfTotal : Ext_data_Model.t Js.t -> Js.number Js.t Js.meth

Get the index within the entire dataset. From 0 to the totalCount.

Like indexOf, this method is effected by filtering.

Parameters:

Returns:


method insert : Js.number Js.t ->
Ext_data_Model.t Js.js_array Js.t ->
Ext_data_Model.t Js.js_array Js.t Js.meth

Inserts Model instances into the Store at the given index and fires the add event. See also add.

Parameters:

Returns:


method isFiltered : bool Js.t Js.meth

Returns true if this store is currently filtered


method isGrouped : bool Js.t Js.meth

Checks if the store is currently grouped

Returns:


method last : 'y. bool Js.t Js.optdef -> 'y Js.t Js.meth

Convenience function for getting the last model instance in the store.

When store is filtered, will return last item within the filter.

Parameters:

Returns:


method load_store : 'z. 'z Js.t Js.optdef -> unit Js.meth

Loads data into the Store via the configured proxy. This uses the Proxy to make an asynchronous call to whatever storage backend the Proxy uses, automatically adding the retrieved instances into the Store and calling an optional callback if required. Example usage:

store.load({
    scope: this,
    callback: function(records, operation, success) {
        // the operation object
        // contains all of the details of the load operation
        console.log(records);
    }
});

If the callback scope does not need to be set, a function can simply be passed:

store.load(function(records, operation, success) {
    console.log('loaded records');
});

Parameters:


method loadData : 'a1. 'a1 Js.t -> bool Js.t Js.optdef -> unit Js.meth

Loads an array of data straight into the Store.

Using this method is great if the data is in the correct format already (e.g. it doesn't need to be processed by a reader). If your data requires processing to decode the data structure, use a MemoryProxy or loadRawData.

Parameters:


method loadPage : 'b1. Js.number Js.t -> 'b1 Js.t Js.optdef -> unit Js.meth

Loads a given 'page' of data by setting the start and limit values appropriately. Internally this just causes a normal load operation, passing in calculated 'start' and 'limit' params.

Parameters:


method loadRawData : 'c1. 'c1 Js.t Js.js_array Js.t -> bool Js.t Js.optdef -> unit Js.meth

Loads data via the bound Proxy's reader

Use this method if you are attempting to load data and want to utilize the configured data reader.

Parameters:


method loadRecords : 'd1. Ext_data_Model.t Js.js_array Js.t -> 'd1 Js.t -> unit Js.meth

Loads an array of model instances into the store, fires the datachanged event. This should only usually be called internally when loading from the Proxy, when adding records manually use add instead

Parameters:


method max : 'e1. Js.js_string Js.t -> bool Js.t Js.optdef -> 'e1 Js.t Js.meth

Gets the maximum value in the store.

When store is filtered, only items within the filter are aggregated.

Parameters:

Returns:


method min : 'f1. Js.js_string Js.t -> bool Js.t Js.optdef -> 'f1 Js.t Js.meth

Gets the minimum value in the store.

When store is filtered, only items within the filter are aggregated.

Parameters:

Returns:


method nextPage : 'g1. 'g1 Js.t -> unit Js.meth

Loads the next 'page' in the current data set

Parameters:


method prefetch : 'h1. 'h1 Js.t Js.optdef -> unit Js.meth

Prefetches data into the store using its configured proxy.

Parameters:


method prefetchPage : 'i1. Js.number Js.t -> 'i1 Js.t Js.optdef -> unit Js.meth

Prefetches a page of data.

Parameters:


method prefetchRange : 'j1 'k1. 'j1 Js.t -> 'k1 Js.t -> unit Js.meth

Ensures that the specified range of rows is present in the cache.

Converts the row range to a page range and then only load pages which are not already present in the page cache.

Parameters:


method previousPage : 'l1. 'l1 Js.t -> unit Js.meth

Loads the previous 'page' in the current data set

Parameters:


method query : 'm1.
Js.js_string Js.t ->
'm1 Js.t ->
bool Js.t Js.optdef ->
bool Js.t Js.optdef ->
bool Js.t Js.optdef -> Ext_util_MixedCollection.t Js.t Js.meth

Query all the cached records in this Store by name/value pair. The parameters will be used to generated a filter function that is given to the queryBy method.

This method compliments queryBy by generating the query function automatically.

Parameters:

Returns:


method queryBy : 'n1 'o1.
'n1 Js.callback ->
'o1 Js.t Js.optdef -> Ext_util_MixedCollection.t Js.t Js.meth

Query all 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.

This method is not effected by filtering, it will always look from all records inside the store no matter if filter is applied or not.

Parameters:

Returns:


method rejectChanges : unit Js.meth

Rejects outstanding changes on all modified records and re-insert any records that were removed locally. Any phantom records will be removed.


method reload : 'p1. 'p1 Js.t -> unit Js.meth

Reloads the store using the last options passed to the load method.

Parameters:


method remove : 'q1. 'q1 Js.t -> unit Js.meth

Removes the specified record(s) from the Store, firing the remove event for each instance that is removed.

A bulkremove event is called at the end passing all removed records and their indices. plus a single 'datachanged' event after removal.

Parameters:


method removeAll_bool : bool Js.t Js.optdef -> unit Js.meth

Removes all items from the store.

Individual record remove events are not fired by this method.

Parameters:


method removeAt : Js.number Js.t -> Js.number Js.t Js.optdef -> unit Js.meth

Removes the model instance(s) at the given index

Parameters:


method removeFilter : 'r1. 'r1 Js.t -> bool Js.t Js.optdef -> unit Js.meth

Removes an individual Filter from the current filter set using the passed Filter/Filter id and by default, applys the updated filter set to the Store's unfiltered dataset.

Parameters:


method sort : 's1.
's1 Js.t Js.optdef ->
Js.js_string Js.t Js.optdef -> Ext_util_Sorter.t Js.js_array Js.t Js.meth

because prefetchData is stored by index this invalidates all of the prefetchedData

Sorts the data in the Store by one or more of its properties. Example usage:

//sort by a single field
myStore.sort('myField', 'DESC');

//sorting by multiple fields
myStore.sort([
    {
        property : 'age',
        direction: 'ASC'
    },
    {
        property : 'name',
        direction: 'DESC'
    }
]);

Internally, Store converts the passed arguments into an array of Ext.util.Sorter instances, and delegates the actual sorting to its internal Ext.util.MixedCollection.

When passing a single string argument to sort, Store maintains a ASC/DESC toggler per field, so this code:

store.sort('myField');
store.sort('myField');

Is equivalent to this code, because Store handles the toggling automatically:

store.sort('myField', 'ASC');
store.sort('myField', 'DESC');

Parameters:


method sum : Js.js_string Js.t -> bool Js.t Js.optdef -> Js.number Js.t Js.meth

Sums the value of field for each record in store and returns the result.

When store is filtered, only sums items within the filter.

Parameters:

Returns: