简体   繁体   English

Ext.js中Store.load方法的时间复杂度

[英]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. 我在EXTJS中具有该功能,我可以从控制器获取存储,然后将其加载。

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. 帐户存储是一个json存储,可能有几千条记录。 Which of the operation is expensive here? 这里哪项操作昂贵? getAccountsStore or the load method. getAccountsStore或load方法。 If load is expensive how can i avoid calling it multiple times? 如果负载昂贵,如何避免多次调用?

getAccountsStore is a lookup of a reference in a collection, its immediate. getAccountsStore是对集合中引用的直接查询。 load of course is expensive. load当然是昂贵的。 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. 通常,除非您的数据发生更改并且您想刷新,否则您无需多次调用load

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. 在您的上下文中,这可能会接受也可能不会接受。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM