Created
January 7, 2016 16:06
-
-
Save javierguerrero/5249652dea3d389727e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="#" onclick="openInDialog(500,600,true,true,false,'http://www.google.com');">Google</a> | |
<a href="#" onclick="openInDialog(500,600,true,true,false,'http://server/sites/demo/Lists/News/NewForm.aspx?RootFolder=&IsDlg=1');">New Element</a> | |
Fuente: | |
https://alinimer.wordpress.com/2013/02/25/open-pages-and-forms-in-modal-dialog-for-sharepoint-2013/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//function to open pages in a dialog | |
function openInDialog(dlgWidth, dlgHeight, dlgAllowMaximize,dlgShowClose,needCallbackFunction, pageUrl) | |
{ | |
var options = { url: pageUrl, width: dlgWidth, height: dlgHeight, allowMaximize: dlgAllowMaximize, | |
showClose: dlgShowClose | |
}; | |
if(needCallbackFunction) | |
{ | |
options.dialogReturnValueCallback = Function.createDelegate(null, CloseDialogCallback); | |
} | |
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options); | |
} | |
function CloseDialogCallback(dialogResult, returnValue) | |
{ | |
//if user click on OK or Save | |
if(dialogResult == SP.UI.DialogResult.OK) | |
{ // refresh parent page | |
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.RefreshPage', SP.UI.DialogResult.OK); | |
} | |
// if user click on Close or Cancel | |
else if(dialogResult == SP.UI.DialogResult.cancel) | |
{ // Do Nothing or add any logic you want | |
} | |
else | |
{//alert("else " + dialogResult); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, thank you for solution.
I have an issue now:
after the OK action there is no refresh of parent page... What reason can this be? I'm inserting script to WebPart "Script Editor" on Wiki Page of SP2013