jQuery UI对话框关闭不会清除对话框 [英] jQuery UI dialog close doesn't clear dialog

查看:111
本文介绍了jQuery UI对话框关闭不会清除对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 jQuery UI ,我有一个标签插件,并且在标签1中加载了一个页面包含一个表格,每一行中都有一个对话框的链接.

Using jQuery UI, I have a tabs plugin and within tab 1 gets loaded a page that contains a table and in each row is a link to a dialog.

一切正常,保存以下内容:

Everything works correctly, save the following:

对话框中的选项是删除从中打开当前对话框的行.确认并删除该行之后,刷新选项卡,并显示新表并删除相关行.

In the dialog is an option to delete the row from which the current dialog was opened from. After confirming, and deleting the row, the tab is refreshed and the new table is shown with the relevant row deleted.

现在,问题是关闭了我执行删除操作的对话框后(通过执行删除操作的JavaScript函数,或通过对话框上的关闭按钮手动进行操作),对话框保留了已删除行中的数据.

Now, the problem is that after closing the dialog where I did the deletion (either though the JavaScript function that did the deleting, or manually via the close button on the dialog), the dialog retains the data from the deleted row.

例如,

列出了三行;

从第2行打开对话框;

Open dialog from row 2;

删除;

从JavaScript函数关闭的对话框,选项卡刷新,现在两行;

Dialog closed from the JavaScript function, tab refreshes, now two rows;

第二行(以前是第3行)中的对话框打开链接与刚刚打开的对话框具有相同的对话框ID;

The dialog open link in the second row (which used to be row 3) has the same dialog id as the one just opened;

点击第2行中的打开对话框链接;

Click open dialog link in row 2;

对话框显示与以前相同-对于旧的第2行,而不是当前的第2行;

Dialog displays same as before - for old row 2, instead of current row 2;

关闭对话框;

点击第2行中的打开对话框链接;

Click open dialog link in row 2;

正确显示-来自当前第2行的数据;

Displays correctly - data from current row 2;

我不知道这是否有意义...这是发生的情况的图片:

I don't know if that made any sense... Here's a picture of what happens:

因此,要删除的行下方的行将继承对话框ID,并且在单击时将显示旧对话框.如果关闭,然后重新打开,它将在对话框中显示正确的内容.

So, the row below the row that gets deleted inherits the dialog id, and when clicked shows the old dialog. If closed, then re-opened, it shows the proper content in the dialog.

我目前正在使用dialog("close")并尝试了dialog("destroy"),但这完全可以杀死它,并且下面的行没有打开任何内容...

I'm using dialog("close") currently and have tried dialog("destroy"), but that totally kills it, and the row below doesn't open anything...

如何解决此问题?

对话框实例化代码:

<script>
    <?php
        $ee=1;
        foreach($bugs->result() as $rr){
            echo "jQuery(\"#dialog_$ee\").dialog({autoOpen:false,width:850,height:550});\n";
            $ee++;
    }?>
</script>

然后打开对话框:

jQuery("#dialog_<?=$i?>").dialog("open");

推荐答案

博客文章

There is an answer in blog post Creating dialogs on demand.

这篇关于jQuery UI对话框关闭不会清除对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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