Open fsomme2s opened 7 years ago
I was able to work around this problem by basically copying the source of PagedFilterTable and changed getPageLength to container.getPageLength. Still doing some testing but initial results look very promising. Attached is my example example.docx
Unfortunately not sure how to fix this properly. The paging logic is borrowed directly from the PagedTable -add-on (https://vaadin.com/directory/component/pagedtable/overview). I tried both fixes suggested here but both of them introduce scroll position jumping when selecting different rows.
As for now, I'll leave it as is. If anyone has an idea how to fix this without breaking anything else, please let me know.
If a PagedFilterTable has a fixed height, so that it does not grow vertically with the count of table rows (instead you want to scroll in the table body), the pagination is buggy.
Once you hit the "next page" button, the totalPagesLabel shows a wrong number. Moreover, you dont land on the proper "next" page.
Example: itemsPerPage is 25, but there is only space for 15 rows. User need to scroll to find the additional 10 rows. 100 Items total = 4 totalPages.
When you hit "next button" the totalPages go up to 7 ( = 100 / 15) and you land on a page, that starts with item number 16.
The problem is, that pagedfiltertable "abuses" the CustomTable.pagelength field. This variable stores how many items are effectively shown (in the example: 15). But PagedFilterTable uses it, as if it was always (pageLength == itemsPerPage), which is only true, if the height of the table is undefined.
You can workaround with overwriting CustomTable.changeVariables and removing the "pagelength" variable - the client sends this variable in order to tell the server: "Hey, only space for 15 Rows here" - this workaround of removing client's "pagelength" variable prevents the pagelength variable to be overwritten by the client... BUT causes strange UI behaviour in return, for example if you select a row in the table that is below the 15-row border: you scroll down to such a row, click on it => and there is a strange jump-bug...
Core problem is: pagelength should not be used to store the itemsPerPage, as it seems to be heavily used by the vaadin framework / CustomTable for UI-Rendering purpose, which is in conflict to its use in PagedFilterTable for pagination purpose.