client side datatable pagination in jsf


if  you want to add simple client side pagination to a datatable in JSF, it is very simple to do so.

suppose you have this regular h:datatable in your page:

<h:dataTable id="datatable" var="item" value="#{someBean.all}">

<f:facet name="header">
<h:outputText value="my header"/>
<h:outputText value="#{item.someField}" escape="true"/>


just use jQuery and use this plugin:

include the plugins and jQuery’s js in your page and just add this to your page:

jQuery(document).ready(function() {

and that is all. It works for 1.2 and 2.0.

btw this thing is useful if you are not using PrimeFaces. PrimeFaces ease your custom needs very quickly. this solution is for a situation where you cannot use PrimeFaces some how.

3 thoughts on “client side datatable pagination in jsf

  1. jQuery(“#accHistoryTable”).tablePagination is not a function
    [Break On This Error] jQuery(“#accHistoryTable”).tablePagination(); I got rhis error on firebug Console.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s