This article describes the use of an SP in SharePoint 2013. RII Modaldialog.showmodaldialog ShowModalDialog undefined problem.
- function Dialogcallback (DialogResult, returnvalue)
- {
- if (returnvalue = = ' 1 ') {
- Alert ("Operation successfully");
- }
- }
- var options = {
- URL: ' URL ',
- width:600,
- height:630,
- Dialogreturnvaluecallback:dialogcallback
- };
- Sp. Ui. Modaldialog.showmodaldialog (options);
The above code works correctly in SharePoint 2010, which is to display a modal window.
However, in SharePoint 2013, there will be (Modaldialog) ShowModalDialog undefined error, how to solve this problem? Use SP. Sod.executefunc:
- function Dialogcallback (DialogResult, returnvalue)
- {
- if (returnvalue = = ' 1 ') {
- Alert ("Operation successfully");
- }
- }
- var options = {
- URL: ' URL ',
- width:600,
- height:630,
- Dialogreturnvaluecallback:dialogcallback
- };
- Sp. Sod.executefunc (
- ' Sp.ui.dialog.js ',
- ' SP. Ui. Modaldialog.showmodaldialog ',
- function () {
- Sp. Ui. Modaldialog.showmodaldialog (options);});
ShowModalDialog undefined workaround when using SP.UI.ModalDialog.showModalDialog in SharePoint 2013