我正在使用Tomahawk t:dataScroller进行分页。它工作得很好。我只会尝试解释一个问题:
第A页包含t:dataTable,它使用t:dataScroller进行分页。 dataTable中有链接可以将我重定向到另一个页面,例如第B页。当我从B回到A时,重新启动分页状态。
我的意思是,如果在页面A中,我在第5页页面,然后转到第B页,当我回到A时,我会在A的第一页。
有没有人经历过这个?有人有任何想法吗?
答案 0 :(得分:1)
您可以控制数据表的'first'属性。你需要什么,
在会话bean中声明一个公共/受保护的变量,
@ManagedBean
@SessionScoped
public class DataTableController implements java.io.Serializable {
protected int first;
// getters and setters...
使用datatable的“first”属性绑定它
<p:dataTable id="results-table" var="result"
...
first="#{dataTableController.first}"
在页面之间导航时,使用类似的内容存储“第一个”记录值,
public void onPageChange(PageEvent event) {
this.setFirst(((DataTable) event.getSource()).getFirst());
}
有关详情,请点击链接。 http://forum.primefaces.org/viewtopic.php?f=3&t=25399#p80324
BTW感谢您的评论