• Need to use xe:pagerSizes more than once on a XPage

    By Peter Arndt 1 decade ago

    I am using xp:Controls and xe.Controls basically more than one time on a xpage, that means, there could be 1 up to 6 instances of the same custom Control.

    The CustomControl itself is using a xp:ViewControl and a  " -Control.

     

    What I realized is, that, when I resize the rows in one xp:ViewControl, the rows of all other xp:viewControls are resized as well.

    So it seems, the resizing row count is saved in a scope variable, and a kind of "namespace" for each instance of a control is missing.

    I guess it would be the same, if I would use another xe:Control like . Does it ?

     

    My general question as well: Are the extension Library controls designed at all to be used more than one time on a Xpage ?

     

    Regards

    Peter

    • have you tried for 'for' attribute?

      By Philippe Riand 1 decade ago

      It is used to point to the data iterator. If you still have a problem, please attach a db that reproduces the issue.

      • for attribute points to the viewPanel id

        By Peter Arndt 1 decade ago

        I am using the "for" attribute of course and it points to the viewPanel ID. What is a bit special in my application is, that the view controls are added  to the page by a repeatcontrol.

        Just try to clearify the issue:

        If I. have 2 VIEWControls on the page, and I am changing the displayed rows at my first VIEWControl to 10 rows , and after that i move to my second VIEWControl where I do a refresh or navigate to the second page by the pager . The result is, that the rows at the second VIEWControl are resized to 10 as well, even if it had before e.g. 50 rows.

        It is quite impossible to post the current database I am working on ( I could give you a online access), of course I can try to create a sample database, but this is what I tried to avoid, because I think my question is quite general:

        The settings when changing the count of rows must be stored somewhere. I guess it could be a viewScope. And is it stored using the at runtime generated id ? Or is there only one variable for that, which will be used from all controls which are using the xe:pagerSize ???

        Furthermore I checked the ID's and the eventHandlers.

        Meanwhile I will post a piece of sample code for the VIEWControl (it is a CustomControl):

        ***********

         

        <xp:viewPanel id="viewPanel0" var="rowData"
        
        viewStyle="width:100.0%" viewStyleClass="sitView"
        
        rowClasses="sitViewRow" columnClasses="sitViewColumn"
        
        unreadMarksClass="sitViewRowUnread" readMarksClass="sitViewRowRead"
        
        captionStyleClass="sitViewCaption"
        
        dataTableStyleClass="xspDataTable sitDataTable"
        
        disableTheme="true">
        
        <xp:this.facets>
        
         
        
        <xp:panel xp:key="headerPager" id="panel2">
        
         
        
        <xp:pager
        
        xp:key="headerPager"
        
        id="pager1"
        
        for="viewPanel0"
        
        partialRefresh="true"
        
        styleClass="pagerRahmen"
        
        disableTheme="false">
        
        <xp:this.rendered><![CDATA[#{javascript:if ((document0.getItemValueString("Cat1Multi") == "1") || (document0.getItemValueString("Cat2Multi") == "1")) {
        
        return document0.getItemValueString("cusePager") == "true";
        
        } else { 
        
        var pager1:com.ibm.xsp.component.xp.XspPager = getComponent("pager1");
        
        rptControl=getComponent(pager1.getFor());
        
        if (rptControl==null) return true;
        
        var total=rptControl.getRowCount();
        
        var rowsperpage=rptControl.getRows();
        
        var totalpages=Math.ceil(total/rowsperpage);
        
        return (document0.getItemValueString("cusePager") == "true") && (totalpages > 1);
        
        }}]]></xp:this.rendered>
        
        <xp:this.pageCount><![CDATA[#{javascript:var NbOfPages = document0.getDocument().getItemValueInteger("cNbPages");
        
        if (NbOfPages == "" | NbOfPages == null) {
        
        return 5;
        
        } else {
        
        return NbOfPages;
        
        }}]]></xp:this.pageCount>
        
        <xp:pagerControl
        
        id="pagerControl1"
        
        type="First"
        
        image="/control_start.png">
        
        </xp:pagerControl>
        
        <xp:pagerControl
        
        id="pagerControl2"
        
        type="Separator">
        
        </xp:pagerControl>
        
        <xp:pagerControl
        
        id="pagerControl3"
        
        type="Previous"
        
        image="/control_play_back.png">
        
        </xp:pagerControl>
        
        <xp:pagerControl
        
        id="pagerControl4"
        
        type="Separator">
        
        </xp:pagerControl>
        
        <xp:pagerControl
        
        id="pagerControl5"
        
        type="Group">
        
        </xp:pagerControl>
        
        <xp:pagerControl
        
        id="pagerControl11"
        
        type="Separator">
        
        </xp:pagerControl>
        
        <xp:pagerControl
        
        id="pagerControl12"
        
        type="Next"
        
        image="/control_play.png">
        
        </xp:pagerControl>
        
        <xp:pagerControl
        
        id="pagerControl13"
        
        type="Separator">
        
        </xp:pagerControl>
        
        <xp:pagerControl
        
        id="pagerControl14"
        
        type="Last"
        
        image="/control_end.png">
        
        </xp:pagerControl>
        
        </xp:pager>
        
        <xe:pagerExpand id="pagerExpand1"
        
        for="viewPanel0">
        
        <xe:this.collapseText><![CDATA[#{javascript:getLanguageStringFor("view.collapseAll");}]]></xe:this.collapseText>
        
        <xe:this.expandText><![CDATA[#{javascript:getLanguageStringFor("view.expandAll");}]]></xe:this.expandText>
        
        <xe:this.rendered><![CDATA[#{javascript:if ((document0.getItemValueString("Cat1Multi") == "1") || (document0.getItemValueString("Cat2Multi") == "1")) {
        
        return true;} else {return false;}}]]></xe:this.rendered>
        
        </xe:pagerExpand>
        
         
        
         
        
        </xp:panel>
        
        <xp:panel xp:key="footerPager" id="panel3">
        
        <xe:pagerSizes
        
        id="pagerSizes1"
        
        for="viewPanel0">
        
        <xe:this.text><![CDATA[#{javascript:getLanguageStringFor("view.showItemsPerPage");}]]></xe:this.text>
        
        <xe:this.rendered><![CDATA[#{javascript:document0.getItemValueString("cshowPagerSize").equals("true");}]]></xe:this.rendered>
        
        </xe:pagerSizes>
        
        </xp:panel>
        
         
        
         
        
        </xp:this.facets>
        
         
        

        **********

        Regards

        Peter

      • Similar behaviour using the standard xp:pager component

        By Peter Arndt 1 decade ago

        Hi Phil,

        Well I realized a similar behaviour when i am using the standard xp:pager component. I will try to explain again, how my solution is basically designed:

        • I have three xp:ViewControl's on the page.
        • All of them are based on one CustomControl.
        • I have a XPage with a repeatControl, which has a list of UNID's as the source.
        • This Xpage has the xc:CustomControl inside. It will give the UNID as a Properties Value to the CustomControl.
        • The CustomControl establish a Data Definition using the properties value.
        • Values and properties for the xp:ViewControl will be rendered on values based on the data definition document.
        • the xp:pager's "For"-Attribute is set with the ID of the xp:ViewControl-Panel

        The result is, when I am moving by the pager on View "A" to page #3, I will go over to the view "B", doing a partial refresh e.g. by opening a category, my view is moving also to page #3, and so on.
        Probably it has sth to do with my special solution, how I render the components. But anyway this is really weird. I think I will try to make a demo database, which I can send to you, except do you have an idea what is causing my problem ?

        Regards

        Peter

      • here is the sample database,demonstrate the xp:pager and xe:pagersize problem

        By Peter Arndt 1 decade ago

        I created a demo based on an MXPD:Chapter 11 database.
        There is a XPage: "sitDemo.xsp"
        this XPage renders twice the CustomControl "sitViewControl".
        There is a xp:pager as well as the xe:pagerSize.
        Furthermore there is a refresh button.
        If you move on the first View to page 3 or extend the rows via xe:pagerSize, click the refresh button on the second view.
        What happens is, that the second pager opens page 3, weired !

        Seems that there is a problem with id's and the corrersponding JSF object.

        If I try to use the xe:savestate component additionally , the XPage even does not render anymore !


        I hope really, you can fixe this or give me an advice for a workaround.

        My idea is to create my own pager control, but I don't know yet, how to do this.

        Could you give me a hintm how to do this ?


        Thanks,
        Peter

        • This is a limitation of core JSF

          By Philippe Riand 1 decade ago

          And because the view is in a dynamic repeat. JSF does not save the first and the rows property on a per repeat instance basis, but for the JSF component itself.

          To get it fixed, select the option 'Create control at page creation' for the repeat control. Because we then have multiple view panels being created, then it works.

          • Solved,but there is still sth weird

            By Peter Arndt 1 decade ago

            Phil, thanks a lot for your help. I didn't realize the flag "create controls on page creation". The controls will be created earlier in the process and pager and pageSizer are working separately now, but when I am using the xe:saveState, the page will not be rendered at all. So I can't use this Extension, this is the same, when I add it in my demo app I posted here.

            Another weird thing in my real application was, that I was using a document collection as a repeat control source. I was reading field values from the documents during the repeat circle. This was producing an error as well. But when I am using an array of document UNID's and instantiate the document from that during the repeat circle than it worked without error. Any idea what is causing the difference ?

             

            Peter

            • Sorry no idea

              By Philippe Riand 1 decade ago

              I don't see why this would make a difference, but there must be a reason :-)

              • But xe:pagerSaveState not working at all in my repeat construct

                By Peter Arndt 1 decade ago

                Maybe it get a bit lost, but when I am using the Extension Control "xe:pagerSaveState" in such a repeatControl, even when I am using the Flag "create Controls on page creation" I get an generall exception and the Page is loading without anything, just a white page. There is no spezific error neither the Conosle nor the log files.

                The behavior can be seen in the demo database I pasted in this thread, if you would insert the

                                globalRows="true">
                            

                 

                to the SIT Custom Control you can watch the behavior.

                Saving the state of a view is a very important issue, and I would be lad, if it would work even in such a repeat construct.

                 

                Regards,

                Peter

                • Do you have more info?

                  By Philippe Riand 1 decade ago

                  Sample DB, generated exception?...