5. Pagination & Sorting - mattstras/cs329e-idb GitHub Wiki
Pagination and Sorting:
For our table formatting we used the jquery plugin located in the file jquery.js. Along with this, we used CDN's to link to different styling and script files provided by datatables.net to give our tables the overall format present. With this, we can give our table an id and do a function call below in a script file to apply the formatting to the table.
$(document).ready(function() { $("#example").DataTable({ "iDisplayLength": 3, "bFilter": false, "bInfo": false, "bLengthChange": false }); } );
In this function call above we further customized the table by setting page length to 3 and removing clutter such as the search bar and page results drop down that were not necessary for tables of our size. Using JQuery, we were easily able to format our tables into a much cleaner output and further customize the base tables to further suit our needs.
We ran into a few issues with implementing the new tables with sort ability in that the way we formatted the entries didn't lend itself to be sorted well, i.e. a mix between numbers and characters. This was a simple fix as it just required us to change the inputs of the table a bit to work with the new features.