开发者

Resetting Primefaces DataGrid Row Data

I have a search form that displays search results in a dialog and lets the user search again and redisplay the different results in the same dialog. I have pagination and the page number wont reset when the user searches again. It will remain on the page where they left it on the last search. I ended up binding the Primefaces DataGrid component and I set the DataGrid.setPage(1) and that fixes the pagination, but the data is still on the last row开发者_开发知识库. Is there a way to rest the DataGrid row? I've tried the DataGrid.setRowIndex but that removes my navigation. Any ideas?


This bug is still there. My workaround:

<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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜