primefaces
primefaces copied to clipboard
DataTable: Pagination combined with first not correct
1) Environment
- PrimeFaces version: 8.0
2) Expected behavior
<p:dataTable pagination="true" rows="20" first="105" ...>
should be the 6th item on the 6th page.
3) Actual behavior
The 6th page is opened but the item is at the very top of that page. But if you go to another page and than back to page 6 again, the item is at the 6th position and not at 0 anymore.
What do you think. Should this be changed?
you know, issues without samples are invalid :P Can you replicate it in the showcase?
Well, the sample (kind of..) is provided in the expected behavior section :D
But here you go: https://github.com/fanste/primefaces-test/tree/test-5649
I would not call this a defect per say. Keeping this 'working' would require passing a 'remainer' to and from the client (so it keeps working using short requestscoped backing beans) and take it into account in calculating a 'new' first. Currently page and pagesize are used for this. 'Improvement' is a better tag, but when a 'lazyDataModel' is used. this can be 'fixed' in there. Not something the datatable should support by definition. Lots of more important things to improve imo.
sample not available anymore please create a issue with reproducer if its still a problem in current github master
I have no idea, why the reproducer was not available anymore...
I pushed it again to the same address and upgraded it to -SNAPSHOT
available on Jitpack. The behavior of the datatable is still wrong.
Open the reproducer, page 6 will be shown with item 105
at the 1st row - but the item should be the 6th row. Switch to page 1 and back to page 6 and everything will be as expected.
Could you create new integrationt test for it and work on a PR?
The issue here is that you set 105 (which is not divisible by 20) as first when it should be 100 at best (or something divisible by 20). DataTable is lenient here, while it could actually throw an exception as it's not quite correct, but since it's a old issue and no one else complain about it, I'm right now more in favor to do nothing about it, or log at best
I vote for lets log it in Development mode so its a warning that its an invalid first
value?