隐藏/重新显示 jQuery 对话框
我正在尝试使用 AJAX 打开 jQuery 对话框。对话框的内容从查询字符串加载,并在表单标记内包含服务器控件。
我有一个 GridView,其中每行中的链接都会生成对话框。
第一次,对话框加载正常,但随后我需要在页面上打开另一个对话框,然后将加载第一个对话框。我以后无法打开同一个对话框。在 Firebug 中检查 DOM 会在页面末尾显示多个“容器”。我有一个 GridView,其中一列包含一个链接和一个空 div。我简化了控件 ID,因为它们被 ASP.NET 破坏了,但这是我的代码:
$('#linkId').click(function() {
$('#panelId').dialog({
autoOpen: true,
height: 600,
width: 680,
modal: true,
show: 'blind',
hide: 'blind',
title: 'More Information',
open: function () {
$(this).load(url).parent().appendTo("form");
},
close(){
// I've also tried using these (not both at the same time)
$(this).dialog('destroy').remove();// dialog never opens again
$(this).dialog('disable').remove();// dialog never opens again
}
});
return false;
});
});
我尝试将包含的函数添加到关闭事件,但得到了相同的效果。否则,当对话框最终打开时,一切都会完美运行(尽管页面末尾有多个对话框容器)。
I'm trying to open a jQuery dialog using AJAX. The content of the dialog is loaded from a querystring and contains server controls inside a form tag.
I have a GridView where a link in each row spawns the dialog.
The first time, the dialog loads fine, but subsequently I need to open another dialog on the page, then the first dialog will load. I can't open the same dialog subsequent times. Inspecting the DOM in Firebug shows multiple 'containers' at the end of the page. I have a GridView where one column contains a link and an empty div. I've simplified the control IDs because they're mangled by ASP.NET, but this is my code:
$('#linkId').click(function() {
$('#panelId').dialog({
autoOpen: true,
height: 600,
width: 680,
modal: true,
show: 'blind',
hide: 'blind',
title: 'More Information',
open: function () {
$(this).load(url).parent().appendTo("form");
},
close(){
// I've also tried using these (not both at the same time)
$(this).dialog('destroy').remove();// dialog never opens again
$(this).dialog('disable').remove();// dialog never opens again
}
});
return false;
});
});
I've tried adding the included functions to the close event, but I get the same effect. Otherwise, when the dialog eventually opens, everything works perfectly (despite there being multiple dialog containers at the end of the page).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 jq dialog api 文档:
From the jq dialog api documentation: