无法在初始化之前在对话框上调用方法;试图调用方法“选项" [英] cannot call methods on dialog prior to initialization; attempted to call method 'option'
问题描述
我在应用程序中使用对话框.但是在为IE优化我的页面时遇到了一些问题.在我的document.ready
函数中,我将此称为
I use dialogs in my app. But I have run to some problems during optimizing my page for IE. In my document.ready
function, I call this
$("#DFormExport").dialog({
resizable: true,
modal: false,
autoOpen: false,
width: 750
});
初始化我的对话框,然后当用户点击按钮时,我称其为对话",因为mydialog中按钮的类型取决于某些用户选择
to inicialize my dialog and then when user hits the button I call this, because the type of buttons in mydialog depends on some user choice
$("#DFormExport").dialog("option", "buttons", {
"Vytisknout": function () {
loading(1);
tiskText($("#DExportCo").attr("href"),"", $("#DExportCo").attr("rm"));
},
Zrušit: function () {
$(this).dialog("close");
}
}).dialog('option', 'title', 'Vytisknout');
在chrome和FF中,一切正常,但是在IE中,我得到cannot call methods on dialog prior to initialization; attempted to call method 'option'
In chrome and FF everything works just fine, but in IE i am getting cannot call methods on dialog prior to initialization; attempted to call method 'option'
那么有什么想法可以解决这个问题?
So any ideas how to solve this?
推荐答案
所以我终于找到了解决方法.要修复IE错误,我仅在创建var dialog=$("#DFormExport").dialog({...})
期间将对话框保存到变量中,然后调用dialog.dialog("option", "buttons", {....})
代替
So I have finally find a sollution. To fix the IE bug, I have just simply saved the dialog to variable during the creaion var dialog=$("#DFormExport").dialog({...})
and then I call dialog.dialog("option", "buttons", {....})
instead
这篇关于无法在初始化之前在对话框上调用方法;试图调用方法“选项"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!