Arun
Arun

Reputation: 1296

Store.load method in extjs time complexity

I have the function in EXTJS which i get a store from a controller and then load it.

functionName: function (controller) {   
    return function() {

        Ext.widget('callWindow');
        var variable= cotroller.getCallWindowPopup();
        controller.getAccountsStore().load({
            params: {
                source_system_id: ssid
            },
            callback: function (records) {
                variable.loadRecord(records[0]);
            }
        });
    }

}

The account store is a json store which might have few thousand records. Which of the operation is expensive here? getAccountsStore or the load method. If load is expensive how can i avoid calling it multiple times?

Upvotes: 0

Views: 549

Answers (1)

Lorenz Meyer
Lorenz Meyer

Reputation: 19915

getAccountsStore is a lookup of a reference in a collection, its immediate. load of course is expensive. It loads all the data in the store, instantiating each record as a model object.

Normally, you don't need to call load more than once, unless your data changes, and you want to refresh.

You can reduce the loading time, if you use a paged store. This loads only one page of data into the store. This may or may not be acceptable in your context.

Upvotes: 1

Related Questions