3

我有一个数据网格,双击网格中的任何记录,我正在导航到 formPanel,其中包含大约 100 多个显示字段。我的问题是,loadRecord 需要很长时间,接近 20 秒才能加载所有这些 100 多个显示字段。有没有更快的方法来做到这一点?非常感谢任何帮助或想法。

Ext.Ajax.request({

    url: someurl
    method: 'POST',
    params: {
        params: params
    },

    success: function(response) {
        var responseData = response.responseText;
        var doc = new DOMParser().parseFromString(responseData, "text/xml");
        store.loadRawData(doc);
        var formPanel = Ext.getCmp('FormPanel');
        var formPanelData = store.getAt(0);
        console.log("Its fast upto here!!");
        formPanel.getForm().loadRecord(formPanelData);
       console.log("Takes upto 20 secs to get here!!");
        var vp = Ext.getCmp('viewport');
        vp.getLayout().setActiveItem('formPanel');


    }
});
4

2 回答 2

6

在加载期间暂停布局:

Ext.suspendLayouts();
form.loadRecord(foo);
Ext.resumeLayouts(true);
于 2012-11-21T00:44:37.077 回答
0

即使在 EXTJs 4.1.3 中过滤掉 Tree Panel 中的数据

暂停布局大大提高了您的搜索速度。见下文 :

applyFilterFn: function(filterCmp) {

        Ext.suspendLayouts();  // Adding by Lokesh to speed up

            var me = this;

            var root = this.getTreeStore().getRootNode();

            me.registerFilter(filterCmp);
            me.filtered = true;

            if(typeof filterCmp.beforeFilter === 'function'){
                    filterCmp.beforeFilter();
            }
            root.cascadeBy(function(node){
                    if(node.isRoot() && !me.rootVisible){ return; }//skip invisible root

                    var nid = (me.useDataIds===true)? node.data.id:node.id;

                    if(typeof me.filterNodeHash[nid]==='undefined'){
                            me.filterNodeHash[nid] = [];

                    }
                    if(filterCmp.filterFn.call(filterCmp,node)){
                            me.filterNodeHash[nid][filterCmp.id] = true;
                          "+me.filterNodeHash[nid][filterCmp.id]);

                    }else{
                            me.filterNodeHash[nid][filterCmp.id] = false;

                            //console.log("value of "+node.data.task+", "+me.filterNodeHash[nid][filterCmp.id]);
                    }
            },me);

            root.eachChild(function(childNode){
                Ext.fly(me.getNodeByRecord(childNode)).setDisplayed(true);
            });                
            root.eachChild(function(childNode){
                me.applyFilters(childNode,0); ////////added changed code
            });               
      //   console.log("root node id "+this.getTreeStore().getRootNode().getId().data.task);
            Ext.resumeLayouts(true); // put it to resume your css layouts

            if(typeof filterCmp.afterFilter === 'function'){
                    filterCmp.afterFilter();
            }

    },// applyFilterFn you may call from a differnt javascript file
于 2013-09-17T08:15:05.737 回答