diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-05-12 09:23:24 +0300 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-05-12 09:23:24 +0300 |
commit | cf981cf3d0924beefa1d558ee760b57a402d2b04 (patch) | |
tree | 535eae8372b91866bcea3b05d5a48333a30d6f9b /js/functions.js | |
parent | 819f01f8a3a66d4dabb6c9f01a322ca7b78e6794 (diff) |
Work properly when there are multiple tables in a page
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'js/functions.js')
-rw-r--r-- | js/functions.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/js/functions.js b/js/functions.js index d01cf070fc..8dc32fa3c1 100644 --- a/js/functions.js +++ b/js/functions.js @@ -778,6 +778,7 @@ AJAX.registerOnload('functions.js', function () { $(document).on('click', 'input:checkbox.checkall', function (e) { var $tr = $(this).closest('tr'); + var $table = $(this).closest('table'); // make the table unselectable (to prevent default highlighting when shift+click) //$tr.parents('table').noSelect(); @@ -807,7 +808,7 @@ AJAX.registerOnload('functions.js', function () { } // remember the last clicked row - last_clicked_row = last_click_checked ? $('tr.odd:not(.noclick), tr.even:not(.noclick)').index($tr) : -1; + last_clicked_row = last_click_checked ? $table.find('tr.odd:not(.noclick), tr.even:not(.noclick)').index($tr) : -1; last_shift_clicked_row = -1; } else { // handle the shift click @@ -832,7 +833,7 @@ AJAX.registerOnload('functions.js', function () { } // handle new shift click - var curr_row = $('tr.odd:not(.noclick), tr.even:not(.noclick)').index($tr); + var curr_row = $table.find('tr.odd:not(.noclick), tr.even:not(.noclick)').index($tr); if (curr_row >= last_clicked_row) { start = last_clicked_row; end = curr_row; |