Foll. is our code to open modal dialog in SharePoint 2013. It worked in 2010. In 2013, I have put a debugger and notice that the debugger wont go into the line after ExecuteOrDelayUntilScriptLoaded. What might be the issue?
function OpenDialog(url, width, height) {
debugger;
ExecuteOrDelayUntilScriptLoaded(openModalDialog, "SP.JS");
function openModalDialog() {
options = SP.UI.$create_DialogOptions();
options.url = url;
options.showClose = false;
options.allowMaximize = false;
if (width != '') {
options.width = width;
}
if (height != '') {
options.height = height;
}
options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
SP.UI.ModalDialog.showModalDialog(options);
}
}
function CloseCallback(result, target) {
}
*UPDATE: I changed the code to the foll. and it has resolved the issue. I would like to know whats happening in SP2013 that is causing this issue?*
function OpenDialog(url, width, height) {
debugger;
var options = {
url: url,
showClose:false,
allowMaximize:false
};
if (width != '') {
options.width = width;
}
if (height != '') {
options.height = height;
}
options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
}
function CloseCallback(result, target) {
}