重置Primefaces数据网格行数据
我有一个搜索表单,它在对话框中显示搜索结果,允许用户再次搜索并在同一对话框中重新显示不同的结果。我已分页,当用户再次搜索时,页码不会重置。它将保留在他们上次搜索时留下的页面上。我最终绑定了Primefaces DataGrid组件,设置了DataGrid.setPage(1)并修复了分页,但数据仍然位于最后一行。有没有办法让DataGrid行休息?我尝试了DataGrid.setRowIndex,但这会删除我的导航。有什么想法吗?这个bug仍然存在。我的解决方法:重置Primefaces数据网格行数据,primefaces,Primefaces,我有一个搜索表单,它在对话框中显示搜索结果,允许用户再次搜索并在同一对话框中重新显示不同的结果。我已分页,当用户再次搜索时,页码不会重置。它将保留在他们上次搜索时留下的页面上。我最终绑定了Primefaces DataGrid组件,设置了DataGrid.setPage(1)并修复了分页,但数据仍然位于最后一行。有没有办法让DataGrid行休息?我尝试了DataGrid.setRowIndex,但这会删除我的导航。有什么想法吗?这个bug仍然存在。我的解决方法: <p:commandBu
<p:commandButton value="#{txt['global.search']}"
id="search-button"
action="#{searchController.search}"
onsuccess="resetPageByNewSearch();"/>
<script type="text/javascript">
function resetPageByNewSearch(data, status, xhr) {
var widget = PrimeFaces.widgets['dataGridWidget'];
if (typeof widget != "undefined") {
widget.getPaginator().setPage(0);
}
}
</script>
函数resetPageByNewSearch(数据、状态、xhr){
var widget=PrimeFaces.widgets['dataGridWidget'];
if(小部件类型!=“未定义”){
widget.getPaginator().setPage(0);
}
}