Extjs:模态窗口的掩码组件 [英] Extjs: Mask component for modal window

查看:113
本文介绍了Extjs:模态窗口的掩码组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在另一个正常窗口中创建一个模态窗口。当我创建一个模态窗口被阻止的掩码。

I need to create a modal window in the other normal window. When I create a modal window is blocked mask.

Ext.application({
name : 'Fiddle',

launch : function() {
    var win2 = null;

    var win1 = Ext.create('Ext.window.Window', {
        closeAction: 'hide',
        width: 500,
        height: 500,
        resizable: false,
        titleAlign: 'center',
        items: {
            xtype: 'button',
            text: 'show modal',
            handler: function() {win2.show()}
        },
        title: 'Simple window'
    });

    Ext.create('Ext.panel.Panel', {
        items: {
            xtype: 'button',
            text: 'show window',
            handler: function() {
                var isRendered = win1.rendered;
                win1.show(null, function() {
                    if (!isRendered) {
                        win2 = Ext.create('Ext.window.Window', {
                            closeAction: 'hide',
                            resizable: false,
                            titleAlign: 'center',
                            width: 200,
                            height: 200,
                            renderTo: win1.getEl(),
                            modal: true,
                            title: 'Modal window'
                        })
                    }
                });
            }
        },
        renderTo: Ext.getBody()
    });
}});

z-index是正确的:

z-index is right:


  • 面具组件是19006

  • 模态窗口组件是19010

  • 简单窗口组件是19000

我不明白我错了什么。

推荐答案

问题是您将 win2 转换为 win1.getEl()。通常情况下,您不要将窗口渲染成任何东西,并让它自己处理。

The problem is that you render win2 into win1.getEl(). Normally, you don't render a window into anything, and let it take care of itself.

的确,如果您删除

renderTo: win1.getEl(),

从你的小提琴,模态窗口正在工作。

from your fiddle, the modal window is working.

如果由于某种原因,你希望win2只能在win1内部进行模态,可以使用

If, for some reason, you want win2 to be modal only inside win1, you can use

floatParent : win1,

on win2

这篇关于Extjs:模态窗口的掩码组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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