In a webpart, I added a button that should trigger a modal dialog, and display a message when the dialog is closed.
The dialog script is handled by this code :
function OpenGenericForm(formUrl, confirmText) {
ExecuteOrDelayUntilScriptLoaded(function () {
SP.UI.ModalDialog.showModalDialog({
url: formUrl,
dialogReturnValueCallback: function (dialogResult, returnVlue) {
RefreshPage(dialogResult);
if (dialogResult == SP.UI.DialogResult.OK) {
SP.UI.Notify.addNotification(confirmText, true);
}
}
});
}, 'sp.js');
}
And the button is :
<a id="someid" onclick="OpenGenericForm('/Lists/gen test/NewForm.aspx','some message');return false;" href="#">label of the link</a>
The modal is opened as expected, but when it closes, I can see the notification a quarter of seconds, before the whole page is reloaded (and then my notification disappeared.
Isn't a call to RefreshPage(dialogResult)
supposed to reload the page using some kind of ajax?
If not, what the correct way to reload content of webparts using ajax?