我有一个对话框,里面有一个表格。下面的代码只是我想要做的一个例子。当您关闭 dijit.Dialog 时,如果您不递归地销毁他的孩子,您就无法重新打开它(使用相同的 id)。
如果您不想破坏您的小部件,您可以执行以下操作:
var createDialog = function(){
try{
// try to show the hidden dialog
var dlg = dijit.byId('yourDialogId');
dlg.show();
} catch (err) {
// create the dialog
var btnClose = new dijit.form.Button({
label:'Close',
onClick: function(){
dialog.hide();
}
}, document.createElement("button"));
var dialog = new dijit.Dialog({
id:'yourDialogId',
title:'yourTitle',
content:btnClose
});
dialog.show();
}
}
我希望这会有所帮助,但使用此代码引发的错误是:
exception in animation handler for: onEnd (_base/fx.js:153)
Type Error: Cannot call method 'callback' of undefined (_base/fx.js:154)
我不得不说我对这个有点迷茫!它快把我逼疯了^^
PS:对不起我的“法语”英语^^