UI: Device Table hide/show decommissioned devices
This commit is contained in:
@@ -101,7 +101,32 @@
|
||||
}
|
||||
};
|
||||
|
||||
$table.dataTable(dataTableOptions);
|
||||
var $dataTable = $table.dataTable(dataTableOptions);
|
||||
|
||||
// Contains Decommissioned Devces?
|
||||
var $tbody = $table.children('tbody');
|
||||
var $decommissionedDevices = $tbody.children('tr.decommissioned');
|
||||
|
||||
if ($decommissionedDevices.length > 0) {
|
||||
var wrapper = $(this).closest('.dataTables_wrapper');
|
||||
|
||||
var $host = $('<div class="dataTables_decommissioned"><label><input type="checkbox" /><span></span></label></div>').prependTo(wrapper);
|
||||
var $span = $host.find('span').text('Hide Decommissioned (' + $decommissionedDevices.length + ')');
|
||||
|
||||
wrapper.on('change', '.dataTables_decommissioned input', function () {
|
||||
var $this = $(this);
|
||||
|
||||
if ($this.is(':checked')) {
|
||||
$table.addClass('hideDecommissioned');
|
||||
} else {
|
||||
$table.removeClass('hideDecommissioned');
|
||||
}
|
||||
|
||||
scrollCheck.apply($table[0]);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
dataTables.push(this);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user