Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Defer Load fails on Table layout on Internet Explorer browser

SA-100454

Summary



Defer Load fails on Table layout on the Internet Explorer browser. Defer Load is introduced in a section. However, it always loads on the Internet Explorer (IE) browser. This occurs post upgrading Pega 8.1.5 to Pega 8.1.7.

The issue does not occur on the Chrome browser.

 


Error Messages

Not Applicable



Steps to Reproduce

  1. Upgrade Pega 8.1.5 to Pega 8.1.7
  2. Configure a section with Repeat dynamic layout
  3. Source the Repeat dynamic layout with a data page
  4. Select the Defer Load check box



Root Cause

Two refresh actions are configured in the parent section which hosts the defer loaded layouts. The Defer Load requests are not fired since the underlying Document Object Model (DOM) elements (the loading message divs) are replaced and detached from the DOM tree.

This is also a timing issue or race condition. Hence, the issue does not occur on the Chrome browser. The sequence of the JavaScript execution and requests vary between the two browsers due to the speed of the execution.



Resolution



Perform the following local-change: 
Add the below code to the UserWorkForm:

<script>

pega.u.d.attachOnload(function () {
    
  pega.ui.LoadManager.prototype.load = function(reloadInfo) {
    
      /* BUG-302028: Route all the (non ADP)deferload requests through the loadQ */
      var directMethodInvokation = false;
      var layoutInfo;
      if(reloadInfo.hasOwnProperty("layoutDiv")){ 
        var lazyParams;
        if(reloadInfo.layoutDiv.hasAttribute("data-parampage")){
          lazyParams = this.getParams(reloadInfo.layoutDiv.getAttribute("data-parampage"));
        }
        if(!lazyParams){
          lazyParams = new SafeURL();
        } 
        if(reloadInfo.layoutDiv.hasAttribute("data-deferinvoke")){
          directMethodInvokation = true;
        }else{
          lazyParams.put("UITemplatingStatus","N");
          reloadInfo["reloadElement"] = reloadInfo.layoutDiv;
          reloadInfo["layoutId"] = reloadInfo.layoutDiv.getAttribute("data-layoutid");
          reloadInfo["qParamsSafeURL"] = lazyParams;
          reloadInfo.layoutDiv.setAttribute("id",reloadInfo.layoutDiv.getAttribute("data-lazyloaddivid"));
          delete reloadInfo.layoutDiv;
          delete reloadInfo.section;
          delete reloadInfo.type;
        }
      }
      if(directMethodInvokation){
        this.loadLazyLoadedElements(reloadInfo.section, reloadInfo.layoutDiv, reloadInfo.type, true, reloadInfo.harnessId);
      }else{
        if (!("reloadElement" in reloadInfo && "layoutId" in reloadInfo)) {
          return false;
        }
        var reloadElement = reloadInfo.reloadElement;
        if (typeof reloadElement === "string") {
          reloadElement = pega.ctx.dom.getElementById(reloadElement);
        }
        /* BUG-307398: Additionally check if the reloadelement is present in the DOM */
        if (!(reloadElement && typeof reloadElement === "object" && reloadElement.parentNode)) {
          return false;
        }
        /*Epic-7677*/
        var safeParamURL1 = reloadInfo.qParamsSafeURL;
        var domChange = "no";
        if ("D_LongPoll" == safeParamURL1.hashtable["pyUsingPage"]) {
          domChange = "yes";
        }
        var currentHarnessId = pega.ctx.pzHarnessID;
        var resetHarnessContext = false;
        if(reloadInfo.harnessId != currentHarnessId) {
          pega.ctxmgr.setContext(pega.ctxmgr.getHarnessContext(reloadInfo.harnessId));
          resetHarnessContext = true;
        }
        /* invoke pega.u.d.reLoad API where our success, failure and loadDOMObject callbacks will be registered */
        var reloadStatus = pega.u.d.reload({
          reloadElement: reloadElement,
          bSectionSubmit: false,
          strReloadType: "Queued",
          queueParams: {
            domElement: reloadElement,
            domAction: "replace",
            domChange: domChange,
            beforeDomActionContext: this,
            beforeDomAction: this.loadQueuedContent,
            layoutId: reloadInfo.layoutId,
            qParamsSafeURL: reloadInfo.qParamsSafeURL
          }
        });
        if(resetHarnessContext) {
          pega.ctxmgr.setContext(pega.ctxmgr.getHarnessContext(currentHarnessId));
        }
        if (reloadStatus === "unsafeToReload") {
          /* reload of the lazy content failed as the container section is getting reloaded.
           * put the info back in the queue to process again.
           * our startLoading is registered as AJAX onLoad function which will resume
           * queue processing after the refresh of container section is over.
           */
          this.loadQ.putInFront(reloadInfo);
          this.loadQ.unlockDequeue();
        }
        pega.u.d.clearReloadedStatus();
      }
      return true;
    }

},true);
  
  
pega.u.d.attachOnload(function () {
  
  pega.ui.LoadManager.prototype.loadQueuedContent = function(responseObj) {
     
      if (!responseObj) {
        return false;
      }

      // add to doc count for test tooling
      pega.ui.statetracking.setLoadMgrBusy();

      var lazyContent = this.getLazyContent(responseObj.responseText);
      if (responseObj.successful && (responseObj.successful == "false" || responseObj.successful == false)) {
        if (lazyContent == null || lazyContent == "") {
          lazyContent = responseObj.responseText;
        }
      }

      var reloadElement = responseObj.argument[0];
      var QParams = responseObj.argument[6];
      
     /*BUG-494059 : Properly checking for domelement in dom */
      var isPartOfDom = pega.ctx.dom.getElementById(QParams.domElement.id);
      if(QParams.adpReload == "ADPLoad"){
        var reloadDivForADP = pega.ctx.dom.$(QParams.domElement).find("div[data-pysectionid='"+QParams.layoutId+"']")[0];
        if(reloadDivForADP)
            QParams.domElement = reloadDivForADP;
      }
      if (isPartOfDom) {
        this.parseContentAndLoadDOM(reloadElement, lazyContent, QParams);
      } else {
        this.afterLoad();
      }

      // add to doc count for test tooling
      pega.ui.statetracking.setLoadMgrDone();

      return false;
    }

},true);
  
</script>



 

Published July 30, 2020 - Updated December 2, 2021

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us