Custom Sorting in Regards to Pagination
Custom Sorting in Regards to Pagination
mbeasley183
Posts: 1Questions: 0Answers: 0
I'm using a jQuery datatable (from Datatables.net) to display live data populated via an AJAX source (but not server side processing). I'm using the pagination option and I have sorting enabled on the columns - but I have a unique situation that I think might involve some custom pagination.
A little background: the table displays job status for a manufacturing facility. Among the information shown for each job (each job is represented by a serialized row in the table) is a target production date for that job. The workers in the facility are used to viewing a similar table as the one I'm creating on a Google Spreadsheet, with new jobs being added to the bottom of the list - hence a "top down" view of the data with the newest target dates being at the bottom and the oldest at the top.
I want to maintain this sort order in the datatable, but I run into two issues:
With pagination (which I need to keep), the 'newest' dates go to the last page. It's important (due to their process) that the newest items are displayed by default -- on the first page.
Even if I just added a line of code to have the table jump to the last page on load (addressing issue #1), I frequently get a view that might just have a couple rows (rather than a screen full of rows) just due to the number of overall records and the iDisplayLenght property.
Is there anyway that anyone knows of to reverse the pagination order and to make sure that the 'last page' always has a full view of rows?
Thanks in advance!
A little background: the table displays job status for a manufacturing facility. Among the information shown for each job (each job is represented by a serialized row in the table) is a target production date for that job. The workers in the facility are used to viewing a similar table as the one I'm creating on a Google Spreadsheet, with new jobs being added to the bottom of the list - hence a "top down" view of the data with the newest target dates being at the bottom and the oldest at the top.
I want to maintain this sort order in the datatable, but I run into two issues:
With pagination (which I need to keep), the 'newest' dates go to the last page. It's important (due to their process) that the newest items are displayed by default -- on the first page.
Even if I just added a line of code to have the table jump to the last page on load (addressing issue #1), I frequently get a view that might just have a couple rows (rather than a screen full of rows) just due to the number of overall records and the iDisplayLenght property.
Is there anyway that anyone knows of to reverse the pagination order and to make sure that the 'last page' always has a full view of rows?
Thanks in advance!
This discussion has been closed.