2017-01-10 42 views
0

我在没有问题的对话框中显示网格。但问题是,对话框阻止了整个页面的背景。无论如何要避免它?即一旦显示对话框,用户仍然可以访问诸如Tab等页面元素。Dojo对话框不想阻止整个页面

+0

认为有一个属性调用模式,将启用或禁用背景 – tik27

回答

0

它可能通过使用CSS。当您创建Dialog并为其提供id媒体资源时,它将创建跨越整个页面的底层<div>,因此您无法点击除新媒体<div>以外的任何内容。幸运的是,你可以隐藏与CSS这样的元素,因为该元素的ID为#<ID of dialog>_underlay产生,你可以简单地做到这一点是这样的:

require(['dijit/Dialog', 'dijit/form/Button', 'dojo/domReady!'], function(Dialog, Button) { 
 
    var dialog = new Dialog({ 
 
    id: 'test', 
 
    title: 'Test', 
 
    content: 'Hello world' 
 
    }); 
 

 
    new Button({}, 'btn').on('click', function() { 
 
    dialog.show(); 
 
    }); 
 
});
/* "test" is the ID of the dialog, so I need to use #test_underlay */ 
 
#test_underlay { 
 
    /* Setting this property to none hides the element */ 
 
    display: none; 
 
}
<head> 
 
    <link href="https://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dijit/themes/claro/claro.css" rel="stylesheet" /> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js" data-dojo-config="async: false"></script> 
 
</head> 
 

 
<body class="claro"> 
 
    <button id="btn">Click me</button> 
 
    <input type="checkbox" />Can you still select me? 
 
</body>

+0

使用此解决方案会导致与dgrids表等某些其他窗口小部件发生某些事件冲突。 –

+0

@ g00glen00b:让我今天尝试一下这个解决方案,并将您更新回来。感谢您花时间回答这个问题。 –

0

相反的对话框中你可以的使用Dojo的FloatingPane。它的工作方式大致相同,您可以使用它下面的对象。

+0

这应该是一个评论,而不是一个答案! –

+0

我只能评论我的答案。当我尝试网站时告诉我_'你必须有50的声望才能发表评论。'__ – Stefano

+0

是的,然后获得声望! –