From 1ef5e976cf734ba92d8b77da3409ce218e5b9999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Thu, 5 Oct 2017 12:32:25 +0200 Subject: [PATCH] :ambulance: fix(interface): Do not sort last line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not sort last line as it’s just a filling empty line. Also only add sorting when headers are used as we need to click on them for sorting. issue #5708 --- html/include/tsorter.js | 4 ++-- include/class_divSelectBox.inc | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/html/include/tsorter.js b/html/include/tsorter.js index 76e4570d8..dbac68035 100644 --- a/html/include/tsorter.js +++ b/html/include/tsorter.js @@ -79,7 +79,7 @@ var tsorter = (function() if( that.prevCol !== -1 && that.ths[that.prevCol].className !== 'exc_cell'){ that.ths[that.prevCol].className = ''; } - that.quicksort(0, that.trs.length); + that.quicksort(0, that.trs.length - 1); } that.prevCol = that.column; }, @@ -152,7 +152,7 @@ var tsorter = (function() var that = this, i; - for( i = 1; i < that.trs.length; i++ ) { + for( i = 1; i < (that.trs.length - 1); i++ ) { that.tbody.insertBefore( that.trs[i], that.trs[0] ); } }, diff --git a/include/class_divSelectBox.inc b/include/class_divSelectBox.inc index b360b4b2d..722a8daaf 100644 --- a/include/class_divSelectBox.inc +++ b/include/class_divSelectBox.inc @@ -105,10 +105,12 @@ class divSelectBox ">\n"; $s_return .= $this->_generatePage(); $s_return .= '</table></div></div>'; - $s_return .= + if ($this->headers !== FALSE) { + $s_return .= '<script type="text/javascript"> var sorter'.$this->id.' = tsorter.create(\''.$this->id.'\'); </script>'; + } return $s_return; } -- GitLab