Featured Post

SQL Query in SharePoint

The "FullTextSqlQuery" object's constructor requires an object that has context but don't be fooled. This context will no...

Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Tuesday, August 16, 2011

Refreshing a SP.UI.ModalDialog's parent page

Basic javascript post around refreshing a modal dialog's parent page. For some reason I didn't find much help online even though such a common function. The dialog options have a property called "diaglogReturnValueCallback" where you can create a delegate callback to another function - remember that this function must exist on the same page. Then inside the Callback function I check whether the dialog result is "Ok" and then I call location.reload(true); Here's the code

//set the callback delegate
options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
                   

// the callback function
function CloseCallback(result, target)
{
  if (result == SP.UI.DialogResult.OK)
  {
    location.reload(true);
  }
}