noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 211/323: sorttable.js : Add an icon if the co


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 211/323: sorttable.js : Add an icon if the column is already sorted
Date: Wed, 14 Mar 2018 17:38:51 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit d557633220792bbf79c24be9fa6c3973127042f3
Author: Dany De Bontridder <address@hidden>
Date:   Fri Feb 16 08:02:28 2018 +0100

    sorttable.js : Add an icon if the column is already sorted
---
 html/js/sorttable.js | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/html/js/sorttable.js b/html/js/sorttable.js
index 8a65474..0a937d6 100644
--- a/html/js/sorttable.js
+++ b/html/js/sorttable.js
@@ -100,7 +100,7 @@ var sorttable = {
         }
 
         // work through each column and calculate its type
-        headrow = table.tHead.rows[0].cells;
+        var headrow = table.tHead.rows[0].cells;
         for (var i = 0; i < headrow.length; i++) {
             // manually override the type with a sorttable_type attribute
             if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip 
this col
@@ -113,6 +113,20 @@ var sorttable = {
                 } else {
                     headrow[i].sorttable_sortfunction = 
sorttable.guessType(table, i);
                 }
+                //--------- if already sorted , add a icon ----------------
+                if 
(headrow[i].className.search(/\bsorttable_sorted_reverse\b/) != -1) {
+                    // if we're already sorted by this column, 
+                    sortrevind = document.createElement('span');
+                    sortrevind.id = "sorttable_sortrevind";
+                    sortrevind.innerHTML = '<img src="image/down.gif">';
+                    headrow[i].appendChild(sortrevind);
+                }
+                if (headrow[i].className.search(/\bsorttable_sorted\b/) != -1) 
{
+                    sortfwdind = document.createElement('span');
+                    sortfwdind.id = "sorttable_sortfwdind";
+                    sortfwdind.innerHTML = '<img src="image/up.gif">';
+                    headrow[i].appendChild(sortfwdind);
+                }
                 // make it clickable to sort
                 headrow[i].sorttable_columnindex = i;
                 headrow[i].sorttable_tbody = table.tBodies[0];



reply via email to

[Prev in Thread] Current Thread [Next in Thread]