Skip to content

Commit

Permalink
making the checkall code work for multiple tables on a single page
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Jun 27, 2012
1 parent 17d73d8 commit 8956657
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
10 changes: 5 additions & 5 deletions Core/Assets/webroot/js/infinitas.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ switch(Infinitas.params.prefix) {
return false;
}
});
$.FormHelper.checkboxToggleAll('#' + Infinitas.model + 'All');

$.FormHelper.checkboxToggleAll('[id*="All"]:checkbox');

$(".trigger").click(function(){
$this = $(this);
Expand Down Expand Up @@ -83,9 +83,9 @@ switch(Infinitas.params.prefix) {
$('#ProductImageProductImage').imageSelect();
});
break;

default:
$(document).ready(function(){
$(document).ready(function(){
$('.tabs').tabs();
//setupStarRating();

Expand Down Expand Up @@ -116,7 +116,7 @@ function setupAjaxDropdowns(){
var $this = $(this);
var $formId = '#' + $(this).closest('form').attr('id');
metaData = $.HtmlHelper.getParams($this);

$.FormHelper.emptySelect(metaData);
if ($this.val().length != 0) {
metaData.postData = $($formId).serialize();
Expand Down
11 changes: 7 additions & 4 deletions Core/Assets/webroot/js/libs/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@
/**
* toggle checkboxes
*/
FormHelper.checkboxToggleAll = function(toggleId) {
FormHelper.checkboxToggleAll = function(selector) {
var tog = false;
$(toggleId).click(function(){
$("input:checkbox[not:"+toggleId+"]").attr("checked",!tog).change();
tog = !tog;

$.each($(selector), function(k, v) {
$(v).live('click', function() {
$("input:checkbox[not:" + $(this).attr('id') + "]", $(this).parents('table')).attr("checked",!tog).change();
tog = !tog;
});
});
};

Expand Down
2 changes: 1 addition & 1 deletion Core/Libs/View/Helper/InfinitasHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class InfinitasHelper extends AppHelper {
public function status($status = null, $options = array()) {
$image = false;
$params = array();

$options = array_merge(
array(
'title_yes' => __d('infinitas', 'Status :: This record is active'),
Expand Down

0 comments on commit 8956657

Please sign in to comment.