function openDialog() { var options = { html: userStoryDetails, width: 600, height: 300, title: "User Story", options.dialogReturnValueCallback = Function.createDelegate(null,portal_modalDialogClosedCallback); //回调函数 }; SP.UI.ModalDialog.showModalDialog(options);}
sharepoint打开对话框调用SP.UI.ModalDialog.showModalDialog()方法,关闭对话框调用
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, '点了确定')
function CloseCallback(result, value) { if(result === SP.UI.DialogResult.OK) { alert("OK was clicked!"); } if(result === SP.UI.DialogResult.cancel) { alert("Cancel was clicked!"); } }
msdn例子: