Pagination question
Pagination question
dan_at_edcity
Posts: 1Questions: 0Answers: 0
Hi.
I recently recommended Datatables to our company as I have used it before and found it a fantastic tool. However, one of our developers believes the pagination is faulty and I wondered what your opinion was.
Using the example DataTables table on your home page I did the following:
- Clicked on the "Last" pagination link to go to the last page of results.
- Changed the number of rows displayed to 25 using the dropdown.
The pagination links change to "1 2 3", which is correct for 58 rows of 25 each. However, at this point rows 34-58 are displayed, which is the last 25 rows. Our developer believes this should actually show the last 8 rows as we are on the last page of three with 25 rows on each. This assumption is backed up by the fact that when I click on pagination link 2 we see rows 26-50 displayed, meaning when I again click on pagination link 3 (the last one) we see 8 rows.
Is he right or is what I've seen desired behaviour?
Thanks.
Dan
I recently recommended Datatables to our company as I have used it before and found it a fantastic tool. However, one of our developers believes the pagination is faulty and I wondered what your opinion was.
Using the example DataTables table on your home page I did the following:
- Clicked on the "Last" pagination link to go to the last page of results.
- Changed the number of rows displayed to 25 using the dropdown.
The pagination links change to "1 2 3", which is correct for 58 rows of 25 each. However, at this point rows 34-58 are displayed, which is the last 25 rows. Our developer believes this should actually show the last 8 rows as we are on the last page of three with 25 rows on each. This assumption is backed up by the fact that when I click on pagination link 2 we see rows 26-50 displayed, meaning when I again click on pagination link 3 (the last one) we see 8 rows.
Is he right or is what I've seen desired behaviour?
Thanks.
Dan
This discussion has been closed.
Replies
This is an excellent question, and one that I don't have a perfect answer for... The change you suggest is something I've been thinking about putting into DataTables 1.10 (I think it did actually do that back in 1.0, but was changed around 1.3...).
The reason I hesitate to put this change in, is what happens in the following case:
You have 100 rows, initially paged at 10 per page. Go to page 2, and then select 25 rows per page. At the moment DataTables will retain the current start position of the table, showing records 10-34. If the scheme you describe above, what would happen? Page 1 displayed and records 0-24 shown?
Expanding upon that, if you have 100 records, and go to page 5 (records 40-49), when select 50 per page, would it show page 1 or page 2?
This is why I've not got a good answer for this - indeed, just more questions... :-). I agree that the current solution is far from perfect, but I'm not yet convinced that the other options will not be even more cumbersome.
What do you, and your colleague, think?
Allan
If you were viewing the 3rd page (10 records per page) and expanded the report to show 20, the most logical place to start would be the currently displayed record set. Adding or reducing the amount of data lines displayed, should always key off the currently displayed first record.