ExtJS 4.1 MVC: How to apply LoadMask to viewport while loading?

拈花ヽ惹草 提交于 2019-12-06 02:16:10

问题


How to apply a LoadMask for a standard ExtJS MVC application's viewport while it is loading the required files?

An example of such MVC application is the following snippet for 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'
                }               
            ]
        });
    }
});

where main above is an xtype for an MVC view, that might extend an ExtJS Panel etc.

Does a standard approach for this ubiquitous requirement exist?


回答1:


What you want to do is to show loading image inside your index.html file. something like that:

<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>

And then hide this div in your launch() function:

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



回答2:


The first solution is good. An alternative is :

http://blog.newbridgegreen.com/extjs-4-splash-screen/



来源:https://stackoverflow.com/questions/11413337/extjs-4-1-mvc-how-to-apply-loadmask-to-viewport-while-loading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!