2012-07-10 31 views
6

如何在standard ExtJS MVC application的視口加載所需文件時應用LoadMaskExtJS 4.1 MVC:如何在加載時將LoadMask應用於視口?

這樣MVC應用的一個例子是用於app.js下面的代碼片斷:

Ext.Loader.setConfig({enabled:true}); 

Ext.application({ 
    requires: [ 
     'Ext.container.Viewport', 
    ], 

    name: 'APP', 
    appFolder: 'app', 

    controllers: [ 
     'Main' 
    ], 

    launch: function() { 

     Ext.create('Ext.container.Viewport', { 
      layout: 'fit', 
      items: [ 
       { 
        xtype: 'main' 
       }    
      ] 
     }); 
    } 
}); 

其中上述main是用於MVC視圖的xtype,這可能延長一個ExtJS Panel

是否一個標準對於這種無處不在的要求存在嗎?

回答

5

你想要做的是在你的index.html文件中顯示加載圖像。類似的東西:

<div id="page-loader"> 
    <img style="position:absolute; width:128px; height:15px; left:50%; top:50%; margin-left:-64px; margin-top: -7px;" src="resources/images/loader.gif" /> 
</div> 

,然後隱藏這divlaunch()功能:

if (Ext.get('page-loader')) { 
    Ext.get('page-loader').remove(); 
} 
+0

正是我想要的! – 2012-07-10 20:30:56