(WIP) Add numbered page navigation when Javascript re-sorting is enabled.

TODO: Add UI for selecting the number.
This commit is contained in:
JeremyRand 2017-04-03 03:18:16 +00:00
parent 6ec256dc34
commit 4a9e64caea
No known key found for this signature in database
GPG Key ID: B3F2D165786D6570

View File

@ -72,6 +72,33 @@ var laterPage = function() {
displayPage();
};
// pageNumber starts at 0.
var numberedPage = function(pageNumber) {
// Find all items.
var allItems = $("#resultscontainer .searchresults");
var itemNumber = pageNumber * requestedResults;
// Check if the item number is too high.
while ( allItems.length - 1 < itemNumber) {
itemNumber = itemNumber - requestedResults;
}
// If the beginning of results is requested, set highestRanking to Infinity.
if ( itemNumber <= 0 ) {
highestRanking = Infinity;
}
else {
var item = allItems.get(itemNumber);
highestRanking = parseFloat($(item).data("ranking"));
}
console.log("highestRanking is now " + highestRanking);
// Update the display to show the new page.
displayPage();
};
var processSidebarNavProtocols = function(navProtocolsOld, navProtocolsNew) {
navProtocolsOld.find(".btn-group-xs").each( function(index, oldProtocol) {
var protocolId = $(oldProtocol).attr("id");