Fixed samples table all rows un/checking. [SCI-845]

This commit is contained in:
Matej Zrimšek 2017-01-05 12:08:03 +01:00
parent 09ef3b3ad5
commit 72df48500d

View file

@ -201,7 +201,7 @@ function dataTableInit() {
});
// Handle click on "Select all" control
$('#samples thead input[name="select_all"]').on('click', function(e) {
$('.dataTables_scrollHead input[name="select_all"]').on('click', function(e) {
if (this.checked) {
$('#samples tbody input[type="checkbox"]:not(:checked)').trigger('click');
} else {
@ -233,10 +233,11 @@ $.fn.dataTable.defaults.noSearchHidden = true;
// Updates "Select all" control in a data table
function updateDataTableSelectAllCtrl(table) {
var $table = table.table().node();
var $chkbox_all = $('tbody input[type="checkbox"]', $table);
var $chkbox_checked = $('tbody input[type="checkbox"]:checked', $table);
var chkbox_select_all = $('thead input[name="select_all"]', $table).get(0);
var $table = table.table().node();
var $header = table.table().header();
var $chkbox_all = $('tbody input[type="checkbox"]', $table);
var $chkbox_checked = $('tbody input[type="checkbox"]:checked', $table);
var chkbox_select_all = $('input[name="select_all"]', $header).get(0);
// If none of the checkboxes are checked
if($chkbox_checked.length === 0){