mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
checkbox parser no longer causes an error when a checkbox doesn't exist
This commit is contained in:
parent
5590ee5c3f
commit
743f99919d
@ -36,14 +36,15 @@
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
format: function(s, table, cell, cellIndex) {
|
format: function(s, table, cell, cellIndex) {
|
||||||
var $c = $(cell).find('input'),
|
var $c = $(cell),
|
||||||
isChecked = $c[0].checked;
|
$input = $c.find('input[type="checkbox"]'),
|
||||||
|
isChecked = $input.length ? $input[0].checked : '';
|
||||||
// adding class to row, indicating that a checkbox is checked; includes
|
// 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
|
// a column index in case more than one checkbox happens to be in a row
|
||||||
$c.closest('tr').toggleClass('checked-' + cellIndex, isChecked);
|
$c.closest('tr').toggleClass('checked-' + cellIndex, isChecked);
|
||||||
// returning plain language here because this is what is shown in the
|
// returning plain language here because this is what is shown in the
|
||||||
// group headers - change it as desired
|
// 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
|
parsed : true, // filter widget flag
|
||||||
type: "text"
|
type: "text"
|
||||||
|
Loading…
Reference in New Issue
Block a user