checkbox parser no longer causes an error when a checkbox doesn't exist

This commit is contained in:
Mottie 2014-03-04 10:45:46 -06:00
parent 5590ee5c3f
commit 743f99919d

View File

@ -36,14 +36,15 @@
return false;
},
format: function(s, table, cell, cellIndex) {
var $c = $(cell).find('input'),
isChecked = $c[0].checked;
var $c = $(cell),
$input = $c.find('input[type="checkbox"]'),
isChecked = $input.length ? $input[0].checked : '';
// adding class to row, indicating that a checkbox is checked; includes
// a column index in case more than one checkbox happens to be in a row
$c.closest('tr').toggleClass('checked-' + cellIndex, isChecked);
// returning plain language here because this is what is shown in the
// group headers - change it as desired
return $c.length ? isChecked ? 'checked' : 'unchecked' : s;
return $input.length ? isChecked ? 'checked' : 'unchecked' : s;
},
parsed : true, // filter widget flag
type: "text"