When I update to new jQuery(v2.1) and jQuery UI (v1.11), I began to recieve error: cannot call methods on dialog prior to initialization; attempted to call method 'close' Also, dialog.dialog stopped working overlay.
Code function:
function ShowPopup(element, restCon, restLay, url) {
$(element).dialog({
autoOpen: false,
resizable: false,
modal: true,
open: function () {
dialogs.push(this);
//other function
},
close: function () {
$(this).dialog('destroy').empty();
$(this).remove();
//other function
},
width: 250,
height: 320,
closeOnEscape: true,
title: "Show ",
position: {
my: "center",
at: "center",
of: $("container")
},
buttons: [
{
text: "Close",
click: function () {
$(this).dialog("close");
}
}
]
});
$(element).load(url, function () {
//other element
});
}
second function:
function CreatePopup(link, contId, restore, url) {
var target = $(link).not(".details-link");
if (target.length > 0)
{
target.addClass("details-link");
target.click(function(){
ShowPopup(
'#' + contId,
restore,
'<div id="'+ contId +'"></div>',
url + $(this).attr('data-id')
);
});
}
}
call function:
$(function () {
var count = '@Model.Count';
setCountToSubTabjQuery($("#client-projects-@guid").closest(".tabs- view").find('.tab-link.tab-link-project').children('.number'), count);
CreatePopup('.project-Name',
'project-info-details-popup-container-@guid',
'#containerProject',
'/Project/Details?id=');
});
HTML:
<div class="details-Item project-Name" data-id="@Model[i].ID">@Model[i].Project</div>