VGLD#39349 geen clone, nu met prefix en postfix icoontjes sorteren

svn path=/Website/branches/v2016.3/; revision=32761
This commit is contained in:
2017-02-09 08:49:37 +00:00
parent dfa8954416
commit 42cd267e18

View File

@@ -239,31 +239,32 @@ var sorttable = {
var hasInputs = (typeof node.getElementsByTagName == 'function') && var hasInputs = (typeof node.getElementsByTagName == 'function') &&
node.getElementsByTagName('input').length; node.getElementsByTagName('input').length;
var hasIcons = node.querySelectorAll('i.fa').length > 0; var hasFontAwesome = node.querySelectorAll('i.fa').length > 0;
var prefix, infix, postfix = "";
if (hasIcons) if (hasFontAwesome)
{ {
var iconClass; for (var i = 0; i < node.childNodes.length; i++) {
node = node.cloneNode(true); if (node.childNodes[i].className != "")
var icons = node.querySelectorAll('i.fa');
for(var icon = 0; icon < icons.length; icon++)
{ {
iconClass = document.createTextNode(icons[icon].className); if (i == 0) prefix = node.childNodes[i].className;
node.replaceChild(iconClass, icons[icon]); // just for sorting purposes else if (i == node.childNodes.length - 1) postfix = node.childNodes[i].className;
else postfix = node.childNodes[i].className; // infix maar even als postfix
} }
}
} }
if (node.getAttribute("sorttable_customkey") != null) { if (node.getAttribute("sorttable_customkey") != null) {
return node.getAttribute("sorttable_customkey"); return node.getAttribute("sorttable_customkey");
} }
else if (typeof node.textContent != 'undefined' && !hasInputs) { else if (typeof node.textContent != 'undefined' && !hasInputs) {
return node.textContent.replace(/^\s+|\s+$/g, ''); return prefix + node.textContent.replace(/^\s+|\s+$/g, '') + postfix;
} }
else if (typeof node.innerText != 'undefined' && !hasInputs) { else if (typeof node.innerText != 'undefined' && !hasInputs) {
return node.innerText.replace(/^\s+|\s+$/g, ''); return prefix + node.innerText.replace(/^\s+|\s+$/g, '') + postfix;
} }
else if (typeof node.text != 'undefined' && !hasInputs) { else if (typeof node.text != 'undefined' && !hasInputs) {
return node.text.replace(/^\s+|\s+$/g, ''); return prefix + node.text.replace(/^\s+|\s+$/g, '') + postfix;
} }
else { else {
switch (node.nodeType) { switch (node.nodeType) {