Reputation: 7517
In the ice:dataPaginator
we can add an actionListener
. Using that event handler or in some other way, can we track the pagination button (anchor) we clicked ?
Upvotes: 0
Views: 1189
Reputation: 1845
Yes, the actionListener
method takes an ActionEvent
argument on which you can call getComponent()
and cast it to DataPaginator. With this object, you can use the getPageIndex()
, getPageCount()
and getPaginatorMaxPages()
methods.
It is all written in the ice documentation: http://icefaces-showcase.icesoft.org/showcase.jsf?grp=compatMenu&exp=paginator
EDIT:
public void actionListener(ActionEvent event) {
setStatus("Data Paginator clicked.");
if ((event.getComponent() != null) &&
(event.getComponent() instanceof DataPaginator)) {
DataPaginator clicked = (DataPaginator)event.getComponent();
StringBuilder sb = new StringBuilder(80);
sb.append("Data Paginator clicked. Current page is ");
sb.append(clicked.getPageIndex());
sb.append(" of ");
sb.append(clicked.getPageCount());
sb.append(" and a maximum of ");
sb.append(clicked.getPaginatorMaxPages());
sb.append(" pages will be displayed.");
setStatus(sb.toString());
}
}
Upvotes: 3