Introduction to extjs store methods and attributes

Source: Internet
Author: User

Store is a storage container that provides record objects for ext devices. Its behavior and attributes are similar to data tables.

Method: do not list inherited methods
Store (Object config)
Constructor. config is defined {
Autoload: Boolean/object, // automatically load
Baseparams: object, // meaningful only when httpproxy is used
Data: array, // data
Proxy: Ext. Data. dataproxy, // data proxy
Prunemodifiedrecords: Boolean, // clear the modification Information
Reader: Ext. Data. Reader, // data reader
Remotesort: Boolean, // remote sorting?
Sortinfo: object, // {field: "fieldname", direction: "ASC | DESC "}
URL: String, // construct httpproxy using URL
}

Add (ext. Data. Record [] records): void
Add records to store

Addsorted (ext. Data. Record record): void
Add record to store and sort (only available for local sorting)

Clearfilter (Boolean suppressevent): void
Clear Filter

Collect (string dataindex, [Boolean allownull], [Boolean bypassfilter]): Array
Collects the unique values of fields specified by dataindex.

Commitchanges (): void
Submitting all changes to the store will trigger an update event.

Filter (string field, string/Regexp value, [Boolean anymatch], [Boolean casesensitive]): void
Set Filter
Field: String // field name
Value: String // If Regexp is a character generator, check whether the field starts with value. If it is a regular expression, check whether the field matches.
Anymatch: Boolean // matches any part, not only the start
Casesensitive: Boolean // case sensitive?

Filterby (function FN, [object scope]): void
More powerful filtering method. FN receives two parameters record and ID

Find (string property, string/Regexp value, [number startindex], [Boolean anymatch], [Boolean casesensitive]): Number
Find the first record that meets the condition. The parameter is the same as that of filter.

Findby (function FN, [object scope], [number startindex]): Number
See filterby

Getat (number index): Ext. Data. Record
Getbyid (string ID): Ext. Data. Record
Obtain the record object based on the filling number/ID.

Getcount (): void
Number of records obtained

Getmodifiedrecords (): Ext. Data. Record []
Get the modified record set

Getrange ([number startindex], [number endindex]): Ext. Data. Record []
Obtains the set of records within the specified range.

Getsortstate (): void
Get the sorting status: it is obviously not void but returns a sorting object, with the same structure as sortinfo {field: "fieldname", direction: "ASC | DESC "}

Gettotalcount (): void
This is useful for paging information.

Indexof (ext. Data. Record record): Number
Indexofid (string ID): Number
Obtain the serial number from the record or ID

Insert (number index, ext. Data. Record [] records): void
Inserts records at the specified position and triggers the Add event.

Isfiltered (): Boolean
If a filter is set, the returned result is true.

Load (Object options): void
The specified proxy uses the specified reader to read remote data.
Options is defined
{
Params: object, // parameters to be attached to the request URL
Callback: function // call back method, which receives three parameters
// R: Ext. Data. Record [] // returned record Array
// Options: Options imported by the options Load Method
// Success: Boolean // success
Scope: object, // range. The default value is store.
Add: Boolean append or update
}

Loaddata (Object Data, [Boolean append]): void
It is easier to use than load for the same purpose, but the data is read locally.

Query (string field, string/Regexp value, [Boolean anymatch], [Boolean casesensitive]): mixedcollection
Queryby (function FN, [object scope]): mixedcollection
Query. The parameters are similar to find, but all matching records are returned, instead of the sequence number of the first matching record.

Rejectchanges (): void
Discard all changes

Reload ([object options]): void
Re-load is equivalent to load (options, false). If no options is input, take the parameter used in the last load.

Remove (ext. Data. Record record): void
Remove a specified record

Removeall (): void
Remove all records

Setdefaultsort (string fieldname, [String dir]): void
Set Default sorting rules

Sort (string fieldname, [String dir]): void
Sort

Sum (string property, number start, number end): Number
Sum the property field from start to end

Event list
Add: (store this, ext. Data. Record [] records, number index)
Beforeload: (store this, object options)
Clear: (store this)
Datachanged: (store this)
Load: (store this, ext. Data. Record [] records, object options)
Loadexception :()
Metachange: (store this, object meta)
Remove: (store this, ext. Data. Record record, number index)
Update: (store this, ext. Data. Record record, string operation)
It is easy to look at the name, and the parameters are not complex.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.