X上的Dojo对话关闭事件(右上) [英] Dojo dialog close event on X (top-right)
问题描述
我使用Dojo创建一个简单的对话框来在系统中创建一个用户。问题是我得到错误:
Im using Dojo to create a simple dialog to create a user in a system. The problem is I get the error:
Tried to register widget with `id==user_submit` but that `id` is already registered
user_submit
,是一个Dojo按钮必须在对话框内完成表单。当我通过点击并提交表单关闭对话框时,再次打开对话框没有问题(在按钮上的点击事件中,我有这一行代码:
user_submit
, is a Dojo button I have to finish the form inside the dialog. When I close the dialog by clicking it and submitting the form there is no problem in opening the dialog again (in the click event on the button I have this line of code:
dijit.byId("user_submit").destroy();
但是如果我通过右上角的[x] -link / button关闭对话框,我不会销毁该按钮,然后无法重新打开该对话框,而无需重新加载页面。
but if I close the dialog through the [x]-link / button in the top-right corner I don't destroy the button and then can't open the dialog again without reloading the page.
如何让Dojo销毁按钮或如何重载[X] -link / button上的click事件,所以我可以为该按钮写出destroy命令?
How do I get Dojo to destroy the button or how to a overload the click-event on [X]-link / button, so I can write the destroy command for the button?
推荐答案
通过使用dojo.connect()找到一个解决方案。
Found a solution. by using dojo.connect().
myDialog.connect(myDialog, "hide", function(e){
dijit.byId("user_submit").destroy();
});
我发布了这个标准后不久会发布邮件,但是我没有足够的分数,所以这里是再说一遍,稍微迟一点: - )
Would have postet this shortly after i posted the quistion, but I didn't have enough points, so here is the answer again, just a little late :-)
这篇关于X上的Dojo对话关闭事件(右上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!