Search code examples
javascriptextjssencha-touch

What is the significance of this 'load' method in extjs?


For the listeners part of this data store in sencha touch, what exactly does the 'load' event mean? I searched the api documentation but was unable to find an explanation in the data store section nor the observable class section.

     new Ext.data.Store({
        model: "",
        proxy: {
            type: "ajax",
            url : "/search/json/",
            reader: {
                type: "json",
                root: "searchResult"
            }
        },
        listeners: {
            load: myapp.results    //Note: myapp.results is a function defined elsewhere
        }
    });

As an additional note, if anyone knows of a reference which lists all of the listener 'eventnames' such as load, and their significance I would be grateful if they would be so kind as to post them here. (The sencha documentation only says: 'The name of the event to listen for. May also be an object who's property names are event names. See' and ends at See )


Solution

  • This event is fired when the data is loaded. You must assign a function to use it.

    listeners:{
         load:function(store,records,options){
              // Do stuff, you can access here to the loaded store, the loaded records and options
         }
     }
    

    It will be called each time the data is loaded, on refresh, on page change, etc.