$(function() {
var $table = $('table.tftable');
$table.on('change', '.chk-all', function() {
var
index = $(this).closest('th').index() + 1,
selector = `td:nth-child(${index}) input[type="checkbox"]`,
checked = this.checked;
$table.find(`tr ${selector}`).prop('checked', checked);
$table.find('tr').slice(1).detach().sort(function(a, b) {
var
aGreen = $(a).find(selector).hasClass('black'),
bGreen = $(b).find(selector).hasClass('black');
return (bGreen ^ aGreen) ? [1, -1][+(checked ^ bGreen)] : 0;
}).appendTo($table);
});
});
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
Вот таблица
https://jsfiddle.net/5ag2muno/