1. SharePoint pop-up box
This article describes the problem of undefined showmodaldialog when sp. UI. modaldialog. showmodaldialog is used in SharePoint 2013.
Function showdialog (title, URL, width, height) {var Options = {URL: URL, argS: 7, Title: title, dialogreturnvaluecallback: dialogcallback}; If (width! = Undefined) options. width = width; If (height! = Undefined) options. height = height; SP. UI. modaldialog. showmodaldialog (options);} // function dialogcallback (dialogresult, returnvalue) to receive the return value {// Where dialogresult = 1 indicates OK, dialogresult = 0 indicates that if (returnvalue! = NULL & dialogresult = 1) {} return ;}
The above code works normally in SharePoint 2010, that is, a window with a pattern is displayed.
But in SharePoint 2013, there will be (modaldialog) showmodaldialog undefined errors. How can this problem be solved? Use sp.sod.exe cutefunc:
1 function showdialog (title, URL, width, height) {2 var Options = {3 URL: URL, 4 ARGs: 7, 5 Title: title, 6 dialogreturnvaluecallback: dialogcallback 7 }; 8 If (width! = Undefined) options. width = width; 9 If (height! = Undefined) options. height = height; 10 11 sp.sod.exe cutefunc (12 'SP. UI. dialog. js', 13' sp. UI. modaldialog. showmodaldialog ', 14 function () {15 sp. UI. modaldialog. showmodaldialog (options); 16}); 17 18} 19 20 // Method 21 function dialogcallback (dialogresult, returnvalue) {22 // Where dialogresult = 1 indicates OK, dialogresult = 0, indicating that 23 if (returnvalue! = NULL & dialogresult = 1) {24 25} 26 return; 27}
2. Close the dialog box
// Disable function closedialog () {window. frameelement. cancelpopup ();}