The load listener callback function of store in Extjs.

Source: Internet
Author: User
In the ExtJS API, the load listener for store is described as follows: load (Storethis, Ext. data. Recordrecords, Objectoptions) triggered when a new Record is loaded. FiresafteranewsetofRecordsh... sy's API in ExtJS describes the store load listener as follows: load (Store this, Ext. data. record records, Object options) is triggered when a new Record is loaded. The Fires after a new set of Records has been loaded listener will pass in the following parameters: this Storerecords Ext. data. Record loaded Record (Ext. data. Record []). The Records that were loadedoptions Object specifies The laoding operation. The loading options that were specified uses The most sto for these three parameters: sto, records, and options, which are rarely used in The next two. During today's development, I encountered some problems. These parameters helped me. For these three parameters, I found some information and posted it: Write the signature function (Store this, Ext. data. record [] records, Object options) the load event starts after loading data, such as autoLoad: true, calling the load method, laodData method, and calling the add method will not trigger this: Store, if the scope is not defined when the event is defined, this parameter is equivalent to the this pointer in the function. here, using this as the parameter name is confusing, and the function parameter has nothing to do with the this pointer inside the function. avoid using this as the parameter name. when a callback is defined, such functions (_ store, _ records, _ ops) are added to indicate internal variables. The JavaScript variable scope is very confusing, and the naming convention is very important to reco. Rds: Ext. data. record [] The Records that were loaded is equivalent to all store data in most cases. In special cases, when The 2nd parameter append is set to true by calling The loadData method, it indicates that The original data is retained, the records is only the data options added by this load: ObjectThe loading options that were specified (see load for details) references to the parameter objects provided when the load method is called. that is, if a load event is triggered by calling the load method, the options parameter is the parameter that calls the load method. load ({params: {start: 0, limit: 50}); then options = {params: {start: 0, limit: 50} which is useful to me? The options parameter is used in the following code: Java code: store_loadByIns (isaccStore, {ip: ips [j], dbid: dbids [j]}, "load ", function (sto, a, B) {// alert (. length); if (sto. getCount ()> = 0) {unAccessable. push (B. params. dbid) ;}}) Where B is the options, but the names are different. Store_loadByIns is a method in the company Class Library. The first parameter of this method is a store instance, and the second parameter is the list of parameters to be passed in json format. The third is the name of the listener to be added, and the fourth is the callback function. If you want to use the input parameter after load, you have to use the options parameter, that is, B in the code above, B. params. dbid is the dbid used to load the store.
Related Article

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.