3 Replies Latest reply on May 11, 2016 4:56 AM by michpetrov

    facing trouble with rich:dataScroller page attribute

    aniketmurtarkar

       

      Hello team,

       

      I am using JSF 2.2.8 and Richfaces 4.5.16.Final (earlier I tried 4.5.13.Final).

       

      I am facing issue with <rich:dataScroller> "page" attribute. I want to update data scroller current page from entering value manually into text box. For this purpose I referred showcase code and followed but I am facing issue with "page" attribute. When "page" attribute is not in datascroller tag, navigation works fine. But required functionality of updating current page manually do not work. When I add "page" attribute, datascroller's "next" and "prev" buttons functionally is disturbed. It is not linear. I tried to use object binding with UIDataScroller but it did not worked to resolve the issue with page attribute.

       

      I have seen couple of comments on other forums where they ask to remove "page" attribute, but I did not understand the purpose of doing this.

       

       

      015.jpg

       

      bellow is the code snippet.

       

      <rich:panel>

      <div>

        <rich:dataTable value="#{mySearchManagedBean.payments}"

            var="myData" id="extdt_paymen" rows="#{myManagedBean.tableRows}"

            styleClass="g-data-table dataTableClass"                                        

            binding="#{myManagedBean.dataTablePayments}">

         <a4j:ajax immediate="true" event="rowclick"

           listener="#{myManagedBean.getPaymentDetails}"

           render=":accountPanel1,:pmt_acct_list,:panel_paymentDetails">

         </a4j:ajax>

         <f:attribute name="sessionmyData"

            value="#{mySearchManagedBean.payments}"/>

         <rich:column headerClass="g-details-header g-align-center g-no-padding">

          <f:facet name="header">

           <div class="g-width-5per">

            <h:outputText value="   "/>

           </div>

          </f:facet>

          <h:selectBooleanCheckbox id="selectValue"

                value="#{myData.selectedVal}"

                styleClass="g-no-border paymentSelection #{myData.account.contains('nbsp') ? 'g-display-hidden':''}"

                disabled="#{ccaUI['status.ofac'] eq  myData.state}">

          </h:selectBooleanCheckbox>

       

         </rich:column>

         ...

         ...

         <rich:column headerClass="g-details-header g-align-center g-no-padding" sortBy="#{myData.valueDate}"

            sortOrder="#{searchManagedBean.sortingBean.sortPymtValueDate}"

            sortType="custom">

          <f:facet name="header">

           <div class="g-width-20per">

            <a4j:commandLink styleClass="g-no-border"

                render=":extdt_paymen,:my_valueDate_asc,:my_valueDate_desc,:my_valueDate_unsort"

                actionListener="#{searchManagedBean.sortingBean.sort}">

             <h:outputText value="Value Date" escape="false"/>

             <f:attribute name="selected" value="valueDate"></f:attribute>

             <f:attribute name="view" value="payment"></f:attribute>

             <f:attribute name="listToBeSort"

                value="#{searchManagedBean.payments}"></f:attribute>

            </a4j:commandLink>

            <ui:include src="/pages/template/common/sortingArrows.xhtml">

             <ui:param name="sortOrderParam"

               value="#{searchManagedBean.sortingBean.sortPymtValueDate}"/>

             <ui:param name="idPrefix" value="my_valueDate"/>

            </ui:include>

       

           </div>

          </f:facet>

          <h:outputText escape="false" value="#{myData.valueDate}">

          </h:outputText>

         </rich:column>

        </rich:dataTable>

       

        <div  style="position: absolute !important;bottom: 62px;height: 16px;width: 33.2%;line-height: 16px;">

         <h:outputText  value="Page " style="float:left;border: none;"/>

         <h:inputText id="pym_ds_numpage" value="#{myManagedBean.dsScrollerPage}" style="float:left;border: none;width:20px;"/>

         <h:outputText id="pym_ds_totalpage" value="of #{myManagedBean.totalPages}" style="float:left;border: none;"/>

         <h:commandButton id="pym_ds-go" value="Go"   style="float:left;border: none;"/>

        

         <rich:dataScroller maxPages="3" id="ds" for="extdt_paymen" stepControls="show" fastControls="hide" style="float:right;border: none;"

             render=":pageNumberOutPutTextTM :pym_ds_numpage :pym_ds_totalpage" scrollListener="#{myManagedBean.onScroll}"

             page="#{myManagedBean.dsScrollerPage}" reRender=":pym_ds_numpage"  binding="#{myManagedBean.scroller}" >

          <f:facet name="first">

       

           <span class="g-button-style g-small-button"><span class="g-bullet-icon g-arrow-left-end"></span></span>

          </f:facet>

          ...

          ...

          <f:facet name="next_disabled">

       

           <span class="g-button-style g-small-button inactive" ><span class="g-bullet-icon g-arrow-right" ></span></span>

          </f:facet>

       

         </rich:dataScroller>

        </div>

          </div>

      </rich:panel>

        • 1. Re: facing trouble with rich:dataScroller page attribute
          michpetrov

          You cannot set the page manually but you can use JS API to trigger the change from some other component.

           

          And for future reference - when you're including a piece of code you should make it as short as possible, trying to find what code is relevant is not much fun.

          • 2. Re: facing trouble with rich:dataScroller page attribute
            aniketmurtarkar

            Hi Michal,

            sorry for the extra code.

            but I am reffering to the richfaces 3.3 url

            6.6.9.  < rich:datascroller > available since 3.0.0https://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/rich_datascroller.html

             

            the code snippet from above url is as follows:

            <rich:dataTable id="carList" rows="7" value="#{dataTableScrollerBean.allCars}" var="category">

            </rich:dataTable>

            <rich:datascroller id="sc2" for="carList" reRender="sc1" maxPages="7" page="#{dataTableScrollerBean.scrollerPage}" />

               <h:panelGrid>

                   <h:panelGroup>

                       <h:outputText value="Set current page number:" />

                       <h:inputText value="#{dataTableScrollerBean.scrollerPage}" id="sc1" size="1"/>

                       <h:commandButton value="Set" />

                   </h:panelGroup>

               </h:panelGrid>

             

            So, is this kind of feature not available in richfaces 4 and above?

            in my existing code if I use below simple datatable and datascroller code still navigations "next" and "prev" are not linear due to presence of "page" attribute. If I remove "page" attribute it works properly. I have checked with Richfaces 4.5.16.Final (earlier I tried 4.5.13.Final).

             

            <rich:dataTable id="carList" rows="7" value="#{dataTableScrollerBean.allCars}" var="category">

            </rich:dataTable>

            <rich:datascroller id="sc2" for="carList" maxPages="3" page="#{dataTableScrollerBean.scrollerPage}" />

             

             

            What is solution for this?  JS API?

            • 3. Re: facing trouble with rich:dataScroller page attribute
              michpetrov

              Yes that doesn't work, you have to use the JS API (or set it manually from the bean but that would be more difficult).