Javascript:ModelDialog

Javascript:ModelDialog

De SharePoint ModelDialog optie geeft je de mogelijkheid om pagina’s te openen in de mooie SharePoint popup. Hieronder een paar links met wat voorbeelden en diverse uitgangspunten.

Ik heb de volgende javascript gebruikt om een ModelDialog te maken zodat een formulier opent, na het invullen van het formulier zal de onderliggende pagina een refresh doen zodat de onderliggende content query een refresh krijgt en de cache opnieuw kan worden gevuld. (gebruik zag anders zijn item niet).

 

<script type="text/javascript">

//User Defined Function to Open Dialog Framework
function OpenDialog(strPageURL)
{
  var dialogOptions = SP.UI.$create_DialogOptions();
  dialogOptions.url = strPageURL;// URL of the Page
  dialogOptions.autoSize = true; // AutoAanpassen van formulier windows, gebruik anders de opties hieronder
  // dialogOptions.width = 850; // Width of the Dialog
  // dialogOptions.height = 680; // Height of the Dialog
  dialogOptions.dialogReturnValueCallback = Function.createDelegate( null, CloseCallback); // Function to capture dialog closed event
  SP.UI.ModalDialog.showModalDialog(dialogOptions); // Open the Dialog
  return false;
}

// Dialog close event capture function
function CloseCallback(strReturnValue, target)
{
  if (strReturnValue === SP.UI.DialogResult.OK) // Perform action on Ok.
    {
   // alert("User clicked Ok!");
   window.location.reload();
    }
  if (strReturnValue === SP.UI.DialogResult.cancel) // Perform action on Cancel.
   {
  // alert( "User clicked Cancel!");
   window.location.reload();;
   }
}

</script>

 

In een content editor gebruik ik de volgende url:

<a onclick="return OpenDialog(&#39;https://—Lists/–/NewForm.aspx&#39;);" href="/_layouts/settings.aspx">Een verzoek of bezwaar indienen</a>

 

bijvoorbeeld:

image

 

Gebruik deze voor standaard opties:  http://www.sharepoint-howto.com/2011/12/15/sharepoint-2010-open-page-in-modal-dialog/

Om een link te opnenen binnen een ModelDialog box : http://www.mssharepointtips.com/tip.asp?id=1094 

Meer variaties : http://saifalmaluk.wordpress.com/2012/05/18/sharepoint-2010-modal-dialog-pop-up/

List of options: http://msdn.microsoft.com/en-us/library/ff410058.aspx