Widget:indexSorterGrouper: Difference between revisions
Jump to navigation
Jump to search
No more line break while grouping |
m Small fix for index group header |
||
Line 197: | Line 197: | ||
var firstIndex = elements.first().data('index'); | var firstIndex = elements.first().data('index'); | ||
var firstTen = Math.ceil(parseInt(firstIndex) / 10) * 10; | var firstTen = Math.ceil(parseInt(firstIndex) / 10) * 10; | ||
if (sortOrder == -1) { firstTen -= 9; } | |||
var groupHeader = $("<h3 />").text(getNumberText(firstIndex) + "..." + getNumberText(firstTen)).addClass("addedbysorter"); | var groupHeader = $("<h3 />").text(getNumberText(firstIndex) + "..." + getNumberText(firstTen)).addClass("addedbysorter"); | ||
groupHeader.insertBefore(elements.first()); | groupHeader.insertBefore(elements.first()); | ||
Line 206: | Line 207: | ||
var nextElement = $(elements[i+1]); | var nextElement = $(elements[i+1]); | ||
createIndexGroup(element, nextElement); | createIndexGroup(element, nextElement, sortOrder); | ||
return true; | return true; | ||
Line 222: | Line 223: | ||
} | } | ||
function createIndexGroup(element, nextElement) { | function createIndexGroup(element, nextElement, sortOrder) { | ||
var currentTen = Math.ceil(parseInt($(element).data('index')) / 10) * 10; | var currentTen = Math.ceil(parseInt($(element).data('index')) / 10) * 10; | ||
var nextElementTen = Math.ceil(parseInt(nextElement.data('index')) / 10) * 10; | var nextElementTen = Math.ceil(parseInt(nextElement.data('index')) / 10) * 10; | ||
Line 228: | Line 229: | ||
var groupHeaderText = getNumberText(currentTen) + "..." + getNumberText(nextElementTen); | var groupHeaderText = getNumberText(currentTen) + "..." + getNumberText(nextElementTen); | ||
if (!isNaN(nextElementTen)) { | if (!isNaN(nextElementTen)) { | ||
if (sortOrder == -1) { | |||
currentTen -= 10; | |||
nextElementTen -= 9; | |||
} | |||
var groupHeader = $("<h3 />").text(groupHeaderText).addClass("addedbysorter"); | var groupHeader = $("<h3 />").text(groupHeaderText).addClass("addedbysorter"); | ||
groupHeader.insertAfter(element); | groupHeader.insertAfter(element); |
Revision as of 19:00, 1 May 2018
Released on this server: