From 91b5c5deb9d56ce2a0581efc4f3ec41813a9ab8f Mon Sep 17 00:00:00 2001 From: Catouse Date: Tue, 4 Nov 2014 11:00:57 +0800 Subject: [PATCH] * fixed errors in method ''selectButton". --- lib/front/front.class.php | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/lib/front/front.class.php b/lib/front/front.class.php index 44596b40f6..7746ddf067 100644 --- a/lib/front/front.class.php +++ b/lib/front/front.class.php @@ -375,25 +375,23 @@ EOT; { $string = << -function selectAll(scope) +$(function() { - var e = $(this); - if(e.closest('.datatable').length) return; - if(scope) $('#' + scope + ' input').each(function() { e.attr("checked", true);}); - else $('input:checkbox').each(function() { e.attr("checked", true);}); -} -function selectReverse(scope) -{ - var e = $(this); - if(e.closest('.datatable').length) return; - if(scope) $('#' + scope + ' input').each(function() { e.attr("checked", !e.attr("checked"));}); - else $('input:checkbox').each(function(){ e.attr("checked", !$(this).attr("checked"));}); -} + $('#allchecker, #reversechecker').click(function() + { + console.log(this); + var e = $(this); + if(e.closest('.datatable').length) return; + scope = e.data('scope'); + scope = scope ? $('#' + scope) : e.closest('.table'); + scope.find('input:checkbox').each(e.hasClass('check-inverse') ? function() { $(this).attr("checked", !$(this).attr("checked"));} : function() { $(this).attr("checked", true);}); + }); +}); EOT; global $lang; - $string .= "{$lang->selectAll}"; - $string .= "{$lang->selectReverse}"; + $string .= "{$lang->selectAll}"; + $string .= "{$lang->selectReverse}"; return $string; }