2012-07-31 62 views
0

我有ExtJS的GridPanel中extjs格真正完全事後?

當我加載店:

I do Ext.getBody().mask(); 

Grid 'afterrender' event fires first 

Store 'load' event fires second 

I attached unmask function to store load 'event' 

但也有少數的時刻,事件, 後,當我看到白格(UNMASK和填充行之間)。

真正完整的afterrender事件揭露的正確方法是什麼? 我的意思是 - 當所有的行都呈現。

感謝

回答

3

我要建議GridView的loadMask配置如文檔覆蓋here。但是我注意到由於某種原因,它不適合我。

如果它不適用於您,只需使用gridview的refresh事件作爲覆蓋here。它只會在數據完全加載到網格後觸發。如果您正在使用MVC應用程序架構

Ext.create('Ext.grid.Panel', { 
    title: 'My Grid Panel', 
    // ... other grid panel configs 
    viewConfig: { 
     listeners: { 
      refresh: function(gridview) { 
       console.log(gridview); 
       console.log('is fully loaded'); 
      } 
     } 
    }, 
}); 

或者:你可以像這樣通過您的GridPanel的viewConfig配置,將其固定

Ext.define('MyApp.controller.MyController', { 
    extend: 'Ext.app.Controller', 

    models: ['MyModel'], 

    stores: ['MyStore'], 

    views: ['MyGridPanel'], 

    init: function() { 
     var me = this; 

     me.control({ 

      // ... other event handlers 

      'mygridpanel > gridview': { 

       refresh: function(gridview) { 
        console.log(gridview); 
        console.log('is fully loaded'); 
       } 

      }, 
     }); 
    } 
}); 
+0

感謝。看起來很有幫助! – 2012-08-02 13:17:26

+0

有點晚了,但我只是不得不面對類似的問題。在Extjs 3.4中,我可以使用grid view事件'viewready'。 – 2014-08-20 09:24:22