I have a EditForm custom page with two webparts connected between them. The first one is a form and the second is list of tasks related to the form item. I have a custom "New Task" button with the following code:
InitClickBtn();
//******** Basic Dialog Starts Here ***********/
function openBasicDialog(tUrl, tTitle) {
var options = {
url: tUrl,
title: tTitle
};
SP.UI.ModalDialog.showModalDialog(options);
}
//******** Basic Dialog Ends Here ***********/
//******** Get URL Params - Start ***********/
var QueryString = function () {
// This function is anonymous, is executed immediately and
// the return value is assigned to QueryString!
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {
query_string[pair[0]] = decodeURIComponent(pair[1]);
// If second entry with this name
} else if (typeof query_string[pair[0]] === "string") {
var arr = [
query_string[pair[0]],decodeURIComponent(pair[1]) ];
query_string[pair[0]] = arr;
// If third or later entry with this name
} else {
query_string[pair[0]].push(decodeURIComponent(pair[1]));
}
}
return query_string;
}();
//******** Get URL Params - End ***********/
function InitClickBtn() {
$(".btn").on("click",function(){
var _url = _spPageContextInfo.webAbsoluteUrl +
"/Lists/Tasks%20List/NewForm.aspx?id=" + QueryString.ID;
openBasicDialog(_url, "New Task Assignment");
});
};
It works very good, but, what when I create a new task in dialog window and save it, the dialog window is closed, the webpart on the parent page is not reloaded following the save, so I don't see the task in the list untill the page is refreshed. When I press on edit button next to he task item the window opens i can update the item and then the webpart is reloaded and changes can imidiately be seen without refreshing the parent page.
Thanks in advance,
Alen