Skip to content Skip to sidebar Skip to footer

Error With Latest Knockout And Jquery Ui Dialog: Cannot Call Prior To Initialization

I try to use with knockout 2.2 custom binding new jquery 1.9 and jquery ui 1.9.2. Code is from here: integrating jquery ui dialog with knockoutjs With updated libraries: http://js

Solution 1:

Checking if the dialog is initialized before calling open will fix it.

if ($(element).data('dialog')) {
    $(element).dialog(shouldBeOpen ? "open" : "close");
}

The initial update is not required at all, as the dialog will be opened during initialization if autoOpen is true, which is the default.

Edit: To be correct when the dialogVisible is initially false a change should be made to set the autoOpen option.

...
options.autoOpen = ko.utils.unwrapObservable(allBindingsAccessor().dialogVisible);
$(element).dialog(options); 

Post a Comment for "Error With Latest Knockout And Jquery Ui Dialog: Cannot Call Prior To Initialization"