将loadMask()应用于extj中的单个元素? [英] Applying loadMask() to a single element in extjs?

查看:108
本文介绍了将loadMask()应用于extj中的单个元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将loadMask应用于只有一个元素,而不是整个浏览器的width-height? .imgur.com / 1qKB1.pngalt =enter image description here>

How to apply loadMask to only one element, and not the whole browser width-height?

default





here ,只有一个元素被屏蔽,并且一个messageBox位于该元素的中心,而不是整个显示... _



here, only one element is masked, and a messageBox is in center, inside this element and not the whole display...



任何想法?


any ideas?

编辑:

@Molecule,谢谢,但这是数据从某些来源加载,我需要的是:

@Molecule , thanks, but this is when data is loading from some source, what i need is :

{
    xtype:"button",
    text:"Alert",
    handler: function(){

        Ext.Msg.show({
        title:'Save Changes?',
        msg: 'You are closing ?',
        buttons: Ext.Msg.YES,
        setLoading: // here somehow only mask parent element, and position alertBox...
    }

}


推荐答案

每个组件都有自己的 loadMask 属性,可以通过调用 YourComponent.setLoading 来使用它,这里是小提琴来说明我在说什么。

Every component has it's own loadMask property. You can use it by calling YourComponent.setLoading. Here is fiddle to illustrate what I'm talking about.

另一种方法是使用 new Ext.LoadMask(YourComponent.el,{msg:Please wait ...}); 。可以在我的小提琴

Another way is using new Ext.LoadMask(YourComponent.el, {msg:"Please wait..."});. You can look at usage in my fiddle.

更新

这里是代码示例,显示如何将ExtJS4 loadMask和MessageBox应用于指定的Widget

Here is code example which shows how to apply ExtJS4 loadMask and MessageBox to specified Widget

Ext.create('Ext.panel.Panel', {
    width: 600,
    height: 400,
    title: 'Border Layout',
    layout: 'border',
    items: [{
        title: 'West Region is collapsible',
        region:'west',
        xtype: 'panel',
        width: 400,
        id: 'west-region-container',
        layout: 'fit'
    },{
        title: 'Center Region',
        region: 'center',
        xtype: 'panel',
        layout: 'fit',
    }],
    renderTo: Ext.getBody()
});
var myMask = new Ext.LoadMask(Ext.getCmp('west-region-container').el, {useMsg: false});
myMask.show();
var msg = Ext.Msg.show({
    title:'Save Changes?',
    msg: 'Bla-Bla',
    buttons: Ext.Msg.OK,
    modal: false
});
msg.alignTo(Ext.getCmp('west-region-container').el, 'c-c');

这里是尝试自己的例子

这篇关于将loadMask()应用于extj中的单个元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆