JSF Data Scroller Pagination Information

in this post I will speak about Displaying JSF Data Scroller Pagination Information.

by default data table and data scroller JSF component  have no direct way to display the pagination information

for example: displaying information about the current displayed records (31 - 40 From 96)

this can be done simply by doing the following steps:

  • define abstract SortableList Class that have dataTable property as follows:
­import javax.faces.event.ActionEvent;
import org.apache.myfaces.component.html.ext.HtmlDataTable;

/**
 * @author <a href="mailto:robinhoo.2006@gmail.com">Ali Abdel-Aziz</a>
 */

public abstract class SortableList extends BaseBean {
    
    /** the data table that will be used in binding to the JSF 
        dataTable component. */
    private HtmlDataTable dataTable;
    
    /**
     * reset Data Scroller to be at the first page.
     * @param e
     */
    public void resetDataScroller(ActionEvent e) {
        if(dataTable != null)
            dataTable.setFirst(0);
    }
 
    /**
     * set the Html Data Table
     * @param dataTable
     */
    public void setDataTable(HtmlDataTable dataTable) {
        this.dataTable = dataTable;
    }
    
    /**
     * get the Html Data Table.
     * @return dataTable
     */
    public HtmlDataTable getDataTable() {
        return this.dataTable;
    }   
}

­

  • any class that deals with data table should extend our defined SortableList as follows:

public class MangedBeanListBean extends SortableList

  • inside the jsf page that you wanna display the pagination information (1 - 20 From 96) ad the following jsf panel grid:
  • add binding to our defined dataTable in <t:dataTable binding="#{managedBeanListBean.dataTable}" >

    and

    <t:panelGrid id="list_page_displaying_Count" columns="1" align="center" 
                 style="width:12%" dir="RTL" >
          <h:panelGroup style="align:ceneter;" styleClass="pagination">
               <h:outputText value="#{mangedBeanBean.dataTable.first + 1} " />
               <h:outputText value=" - " />
               <h:outputText value="#{(mangedBeanListBean.rowCount < (sharedUtil.noOfTableRows + mangedBeanListBean.dataTable.first)) ? 
                                       mangedBeanListBean.rowCount : (sharedUtil.noOfTableRows + mangedBeanListBean.dataTable.first)} " />
               <h:outputText value=" #{globalResource.from} " />
               <h:outputText value="#{mangedBeanListBean.rowCount}" />
          </h:panelGroup>
    </t:panelGrid>­

 

this will­ generate the following pagination information:


First, we allocution about

First, we allocution about http://www.careerbliss.co.uk the accidental clothes

I think more updates and

I think more updates and will be returning. I have filtered for qualified edifying substance of this calibre all through the past various hours.Jaya Liga 

Agen Ibcbet

I really liked it. Keep

I really liked it. Keep sharing such excellent post like this in future too. Informative and good article.

Very helpful blog! It is easy to use, and answered all my questions! I will be back

gamereasy.com

guitarist Bill

The old building has been replaced with new splashy colorful restrainer ,was replaced with a new splashy! Cellini watch best

thanks for the information..

Thanks for the information.. this could be useful to many people..

how to buy instagram comments

Yeah I also agree. I have

Yeah I also agree. I have hard time solving for these and thanks now i found the solution thanks guys, this will really help me a lot.

Good thing that I found this

Good thing that I found this information here, this is something I have been looking for, Thanks. This will help me a lot.

Powered by Drupal - Design by artinet