2 Replies Latest reply on Apr 5, 2012 2:39 AM by anis jaballah

    datascroller first and last page

    anis jaballah Newbie

      Hi,

       

      I want to do not display the first and last link in the datascroller and only display next and previouse link in the datascroller,

       

      Is there any solution?

       

      Thanks,

        • 1. Re: datascroller first and last page
          Sandeep Singh Newbie

          HI Anis,

           

          I would suggest that you create your own dataScroller.

          Even I had the same requirment in my project so I created my own custom compoenent.

          For details see code below:

           

          <composite:interface shortDescription="Custom Scroller Component for form pagination.first index should always be zero.">

             

                  <composite:attribute name="paginateAction"          required="true"     method-signature="java.lang.String action()" />

                  <composite:attribute name="currentIndex"            required="false"    type="java.lang.Integer" />

                  <composite:attribute name="maxCount"                required="true"     type="java.lang.Long" />

                  <composite:attribute name="renderForSingleRecord"   required="false"    default="true" />

                  <composite:attribute name="disableFirst"            required="false"    default="false" />

                  <composite:attribute name="disableLast"             required="false"    default="false" />

                  <composite:attribute name="showCounter"             required="false"    default="true" />

                  <composite:attribute name="styleClass"              required="false"    default="float-right" />

                  <composite:attribute name="renderOnNavigate"        required="false"    default="@form" />

                 

              </composite:interface>

             

              <composite:implementation>

                  <h:panelGroup rendered="#{cc.attrs.renderForSingleRecord}" styleClass="#{cc.attrs.styleClass} rf-ds">

                 

                      <a4j:commandLink

                          id="first"

                          value="&#171;&#171;&#171;"

                          immediate="true"

                          styleClass="rf-ds-btn rf-ds-btn-first rf-ds-dis"

                          render="#{cc.attrs.renderOnNavigate}"

                          action="#{cc.attrs.paginateAction}"

                          rendered="#{!cc.attrs.disableFirst}"

                          disabled="#{cc.attrs.currentIndex == 0}">

                          <f:setPropertyActionListener target="#{cc.attrs.currentIndex}" value="0" />

                      </a4j:commandLink>

                     

                      <a4j:commandLink

                          id="previous"

                          value="&#171;"

                          immediate="true"

                          styleClass="rf-ds-btn rf-ds-btn-prev rf-ds-dis"

                          render="#{cc.attrs.renderOnNavigate}"

                          action="#{cc.attrs.paginateAction}"

                          disabled="#{cc.attrs.currentIndex  le 0}">

                          <f:setPropertyActionListener target="#{cc.attrs.currentIndex}" value="#{cc.attrs.currentIndex - 1}"/>

                      </a4j:commandLink>

                     

                      <h:outputText value=" #{cc.attrs.currentIndex+1} of  #{cc.attrs.maxCount} " rendered="#{cc.attrs.showCounter}"/>

                     

                      <a4j:commandLink

                          id="next"

                          value="&#187;"

                          immediate="true"

                          styleClass="rf-ds-btn rf-ds-btn-fastfwd rf-ds-dis"

                          render="#{cc.attrs.renderOnNavigate}"

                          action="#{cc.attrs.paginateAction}"

                          disabled="#{cc.attrs.currentIndex + 1 >= cc.attrs.maxCount}">

                          <f:setPropertyActionListener target="#{cc.attrs.currentIndex}" value="#{cc.attrs.currentIndex + 1}"/>

                      </a4j:commandLink>

                     

                      <a4j:commandLink

                          id="last"

                          value="&#187;&#187;&#187;"

                          immediate="true"

                          styleClass="rf-ds-btn rf-ds-btn-last rf-ds-dis"

                          render="#{cc.attrs.renderOnNavigate}"

                          action="#{cc.attrs.paginateAction}"

                          rendered="#{!cc.attrs.disableLast}"

                          disabled="#{cc.attrs.currentIndex +1 >= cc.attrs.maxCount}">

                          <f:setPropertyActionListener target="#{cc.attrs.currentIndex}" value="#{cc.attrs.maxCount -1}"/>

                      </a4j:commandLink>

                     

                  </h:panelGroup>

              </composite:implementation>

           

          Hope this helps and solves your problem.

           

          Cheers,

          Sandy

          • 2. Re: datascroller first and last page
            anis jaballah Newbie

            Thank you Sandy,

             

            Your solution is wonderful but i found something much easy :

            boundaryControls="hide" fastControls="hide"

            and it is working fine and giving me what I want