3
  • 我创建分页

    pagination = PaginationBuilder.create().pageFactory(new Callback<Integer, Node>() {
        @Override
        public Node call(Integer pageIndex) {
            return createChartPage(pageIndex);
        }
    }).build();
    
  • 我希望总页数可以改变。

  • 当我设置PageCount(totalPages)时。更改 pageCountproprety 通知 pageFactory 并使用 index = 0 进行回调;

    - 我的问题。

  • 当我更改 PageCount 时,我希望页面索引不会改变。

  • 换句话说,我如何从 pageCountProperty 中删除ChangeListener。
4

1 回答 1

1

在工厂方法上使用此解决方法,直到它在 JDK 中得到修复:

 private Parent createPage(Integer pageIndex) {

    // Fix for Pagination.getPageCount resetting the current index to 0
    if (Math.abs(previousPageIndex - pageIndex) > 1) {
        mainPagination.setCurrentPageIndex(previousPageIndex);
        return root.get(previousPageIndex);
    } else {
        // Normal navigation
        previousPageIndex = pageIndex;
        return root.get(pageIndex);
    }

}
于 2015-08-18T06:40:55.800 回答