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

Javascript scroll to bottom not working in IAC

SA-24674

Summary



We have a requirement in a question and answer flow to scroll to the bottom each time an assignment screen loads. This is so the last question is visible to the user and new questions are added each time the user submits a screen.

We added the following Javascript and it works fine when testing in standard end user desktop. It is not working when testing the flow in IAC.

<script>
window.scroll(0,50000000);
window.onload=toBottom;
function toBottom()
{
window.scrollTo(0, document.body.scrollHeight);
}
</script>


Error Messages



Not Applicable 

Steps to Reproduce



Standard Web Mashup using createNewWork.

Root Cause



When imbedding the gadget the scroll bars were part of the top level application and not within PRPC. The gadget HTML was within a top level application iframe so to auto scroll to the bottom onload of the PRPC content the top level application has to handle this. 

Resolution



In PRPC when you want to tell the parent application to scroll to bottom send a message through the IAC custom event to the parent applicaiton.

Put the following in section in the harness were you want to tell the top level application to scroll to bottom on the onload event of the PRPC content.

<script>

window.onload=toBottom;
function toBottom(){
  pega.desktop.gadgetCustomEvent("ScrollToBottom");
}
</script>

In the top level application gadget HTML:

function pegaCustom(gadgetName,strToken) {
    
    if (strToken == "ScrollToBottom") {
        scrollToBottomOfParentIframe();
   }
   
}
function scrollToBottomOfParentIframe(){
  var parentIframe =  TODO: Top Level Application Developer:  Find parent iframe window object.
   parentIframe.scrollTo(0, parentIframe.document.body.scrollHeight);
}

 

Suggest Edit

Published June 20, 2016 - Updated October 8, 2020

Did you find this content helpful? Yes No

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.

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