Multiple Lists Pagination Issue

In order to work around an issue with Dashboards I am building a simple ASP page which displays two lists side by side.  One list displays all outstanding communications for the user, the other displays all outstanding communications for the Team the user is associated with.  When the list becomes paginated the page increment / decrement buttons appear not to work.  However, it is possible to manually specify the page number to view.  Does anyone know why the page increment / decrement buttons are not working?  This is standard functionally of the list object and there is no code around pagination in my ASP page.

To work round this issue I could build the lists using my own HTML rather than invoking a list but this would involve significantly more development.  

P.S. The reason for building this page rather than simply using a Dashboard is that an issue has been identified (CRMS-1572) when trying to display communications on a dashboard which are linked to an order where the user is not a system administrator within Sage CRM.  The Gadget just errors

  • 0 in reply to Sage CRM

    Sorry, I am really struggling with this article and having tried to implement this into my code it doesn't appear to be working.  I'm concerned that it dates back to 13 Mar 2009 and a lot has changed with Sage CRM in that time regarding the UI and the underlying HTML which is generated.  It also concerns me that the article states "This method is something of a cheat and there are still problems with this approach. ".

    Looking at the code example I'm struggling to work out what the following line is supposed to do.  It seems to be terminating a block of HTML code but what block and why?

    myContentBlock.contents = '")+'">'; -- Uneven Number Of Quotation Marks

    This piece of code is also syntactically incorrect as it contains an odd number of single quotes.  Presumably the middle single quote is supposed to be escaped, but doing this doesn't seem to do a lot

    myContentBlock.contents = '")+\'">';

    There is also a random piece of client side code in the example.  This does appear outside of the ASP tags but the code above it is server side, the braces in the example suggest that this is all one piece of code.

    document.all[i].target = "EWARE_MID";

    My understanding is that what this code is trying to achieve is adding a blank content block to the container and then populating that content block with the list.  But I don't see how this is working.

    In general it is unusual to add more than one list block to a custom page but as discussed in the original post I am trying to replace a dashboard due to an issue within dashboards.

  • 0 in reply to Sage CRM

    Thank you for that, the updated article is much clearer.  However, I'm having issues with the client side script

    "The Inner page is a little different. The code includes some client side JavaScript that makes sure the hyperlinks correctly target the main frame of CRM."

    The script as is does not appear to work but I can see what it is trying to do, set the target for all A tags.  This being the case I have create my own version, which does change the target.  

    <script>
    window.addEventListener('load',setHREFTarget);

    function setHREFTarget(){
        var links = document.getElementsByTagName('a');

        for(var l=0; l<links.length; l++){
            links[l].target = '_parent'; //Opens Target Record As Expected But Save Or Continue On Target Record Does Not Redirect Correctly
            console.log('HREF Target Changed');
        }
    }
    /*
        //links[l].target = '_top'; //Opens Target Record As Expected But Save Or Continue On Target Record Does Not Redirect Correctly
        //links[l].target = '_blank'; //Opens Target Record In A New Tab
        //links[l].target = '_self'; //Opens Target Record In iFRAME
        //links[l].target = 'EWARE_MID'; //Opens Target Record In A New Tab
    */
    </script>
    The issue is that none of the targets give the functionality desired.  _parent and _top open the target record in the main CRM window but when that target record is saved or the continue button is selected the redirect is back to a blank page. Load the custom dashboard ASP page
    The links on the dashboard work as expected and open the target record in the main CRM window
    Saving that record loads a blank page.  The issue I think is that the redirect is going back to the iFRAME child page (Dashboard) rather than the full ASP page which contains the iFRAMES (CustomDashboard) 
    I'm also struggling to get the iFRAMES to appear side by side as per my original ASP page which displays the lists next to each other.  My understanding was that iFRAMES are a deprecated feature in HTML so I haven't used them for years.  I've tried to add an inline style STYLE="display: inline; but that does not appear to work.
  • 0 in reply to AlisonA

    Sometimes it is best to walk away from an issue and come back to it later with a fresh pair of eyes.  For the second part of my issue with IFRAMES displaying them side by side, simply use the NewLine property on the Block.

    var container = CRM.GetBlock("container");

    pannel1 = CRM.GetBlock('Content');
    pannel1.contents += IFRAMECODE

    pannel2 = CRM.GetBlock('Content');
    pannel2.contents += IFRAMECODE

    pannel2.NewLine = false;

    page.AddBlock(pannel1);
    page.AddBlock(pannel2);
    I made the silly mistake of trying to set the IFRAMES themselves to be inline using 
    STYLE="display: inline;" rather than setting the blocks built by CRM to be on the same line.  This is not going to work as each Block only contains a single IFRAME.
  • 0 in reply to AlisonA
    I'm still working on a resolution for being redirected back to a blank screen but I have reworked the "The Inner page is a little different. The code includes some client side JavaScript that makes sure the hyperlinks correctly target the main frame of CRM.".  The pagination buttons need to work within the iFrame so these are excluded from the target altering script.
    <!--
        Client Side Script To Load Target Record Screen In The Parent Window When Selected From the List
        Without This Script The Target Record Is Displayed Within The iFrame
        Add To Bottom Of ASP Page So That It Is Guarenteed To Run After After The Page Has Been Rendered
    -->
    <script>
    window.addEventListener('load',setHREFTarget); //Load Function When Page is Rendered

    function setHREFTarget(){
        var links = document.getElementsByTagName('a'); //Get All Hyperlinks On The Page

        for(var l=0; l<links.length; l++){ //Loop Through Each Hyperlink
            var hrefClass = links[l].className; //Get The Class Name Of The Hyperlink

            if(hrefClass.length == 0){ //Links On Pagenations Buttons Have A Class Name, Do Not Alter The Links On Buttons
                links[l].target = '_parent'; //Opens Target Record Within The Parent Window
                console.log('HREF Target Changed'); //Assist With Debugging
            }
        }
    }
    </script>