3

Help with either or both is highly appreciated. Have been stuck on this for weeks...

  1. Question 1: How can I speed up my Page Refresh? Right now, it takes a solid 1.5 seconds. That doesn't seem like a lot, however it's noticeable and clunky for the users. I have tried to remove WPs in order to speed it up, and nothing is helping.
  2. I am using a Page Refresh script that automatically Refreshes a Site Page every time a modal box/pop-up is closed. Is there are way to limit the script to running ONLY on 'Save' (and NOT refresh on 'Cancel')?

The reason I'm running this script is because the Async. Refresh doesn't work for me, because it blows out the values in my HTML text filter. As a result, I'm using the script mentioned above. Ideally, the page would refresh whenever a change was made to any item or document in any of the LVWPs that exist on my Site Page. Is there are way to limit the script to running ONLY on 'Save' (and NOT refresh on 'Cancel')?

The script I'm using is below...

function OpenPopUpPage(_url) {
var options = {
url: _url,
title: "Modal Popup",
allowMaximize: true,
showClose: true,
dialogReturnValueCallback: Function.createDelegate(null, closewindow)
};
SP.UI.ModalDialog.showModalDialog(options);
}

function closewindow() {
SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);        
}
  • can you add more details for 1st issue, what all things you are doing on this page. 1.5 seconds is really fair good speed of sharepoint page. – Siddharth Vaghasia Dec 9 '16 at 16:22
  • Yeah, there are 10 Web Parts on it in a tabbed format. There's also an autotagger textbox WP that assigns that value of that textbox as metadata to any document or item created. – TheJDScott Dec 9 '16 at 16:28
2

For 2nd issue - Can you try below...your close window should be like

 function closewindow(strReturnValue, result, target)
 {
   if (strReturnValue === SP.UI.DialogResult.OK) // Perform action on Ok.
     {

SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);      

     }

   if (strReturnValue === SP.UI.DialogResult.cancel) // Perform action on Cancel.
    {
     //do nothing...
    }


}
  • Incredible. It worked. I have spent 2 weeks on that. Thank you so much. – TheJDScott Dec 9 '16 at 16:25
  • glad it helped... :) may be you would have put issue in forum earlier :P..anyways happy coding..!! – Siddharth Vaghasia Dec 9 '16 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.