0
在ice:dataPaginator
中,我们可以添加一个actionListener
。使用该事件处理程序或以其他方式,我们可以跟踪我们点击的分页按钮(锚点)吗?ICEfaces dataPaginator actionListener
在ice:dataPaginator
中,我们可以添加一个actionListener
。使用该事件处理程序或以其他方式,我们可以跟踪我们点击的分页按钮(锚点)吗?ICEfaces dataPaginator actionListener
是的,actionListener
方法采用ActionEvent
参数,您可以在其中调用getComponent()
并将其转换为DataPaginator。通过此对象,您可以使用getPageIndex()
,getPageCount()
和getPaginatorMaxPages()
方法。
这是所有书面冰文档中:http://icefaces-showcase.icesoft.org/showcase.jsf?grp=compatMenu&exp=paginator
编辑:
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());
}
}