How use in TableView paginator.?.For This exmple...
public class SampleController implements Initializable {
@FXML private TableView
I discovered a little problem when testing out the pagination code produced on this thread. When the size of the data == to the number of rows that one has set in a page, chaos (within the pages) would occur. In this case, an additional (blank) page is created and data refuses to show up on any of the pages. I believe that the following snippet should solve that issue (if anyone else is encountering the same problem as me). This snippet should come before declaring the Pagination variable.
int numOfPages = 1;
if (data.size() % rowsPerPage == 0) {
numOfPages = data.size() / rowsPerPage;
} else if (data.size() > rowsPerPage) {
numOfPages = data.size() / rowsPerPage + 1;
}
Pagination pagination = new Pagination((numOfPages), 0);
pagination.setPageFactory(this::createPage);
Hope it helps!