diff --git a/APPL/Localscripts/sorttable.js b/APPL/Localscripts/sorttable.js index 0ab5c93ade..a18a109d90 100644 --- a/APPL/Localscripts/sorttable.js +++ b/APPL/Localscripts/sorttable.js @@ -239,31 +239,32 @@ var sorttable = { var hasInputs = (typeof node.getElementsByTagName == 'function') && 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; - node = node.cloneNode(true); - var icons = node.querySelectorAll('i.fa'); - for(var icon = 0; icon < icons.length; icon++) + for (var i = 0; i < node.childNodes.length; i++) { + if (node.childNodes[i].className != "") { - iconClass = document.createTextNode(icons[icon].className); - node.replaceChild(iconClass, icons[icon]); // just for sorting purposes + if (i == 0) prefix = node.childNodes[i].className; + 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) { return node.getAttribute("sorttable_customkey"); } 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) { - return node.innerText.replace(/^\s+|\s+$/g, ''); + return prefix + node.innerText.replace(/^\s+|\s+$/g, '') + postfix; } else if (typeof node.text != 'undefined' && !hasInputs) { - return node.text.replace(/^\s+|\s+$/g, ''); + return prefix + node.text.replace(/^\s+|\s+$/g, '') + postfix; } else { switch (node.nodeType) {