cannot call methods on dialog prior to initialization; attempted to call method 'option'

二次信任 提交于 2019-12-11 02:06:05

问题


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
});

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'); 

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?


回答1:


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



来源:https://stackoverflow.com/questions/15626675/cannot-call-methods-on-dialog-prior-to-initialization-attempted-to-call-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!