sidebar built from config, colvis defaults from sidebar
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
var freeDate = moment().subtract( [% params.age_num %], '[% params.age_unit %]' );
|
||||
var table = $('#dp-data-table').dataTable({
|
||||
$('#dp-data-table').dataTable({
|
||||
"deferRender": true,
|
||||
"order": [[ 1, "asc" ]],
|
||||
"colVis": {
|
||||
@@ -569,40 +569,6 @@ $(document).ready(function() {
|
||||
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
|
||||
});
|
||||
|
||||
// display the column show/hide buttons in the sidebar
|
||||
var colvis = new $.fn.dataTable.ColVis( table );
|
||||
var columns = colvis.s.dt.aoColumns;
|
||||
|
||||
// first remove existing controls, in case indexes have changed
|
||||
$('#nd_column-controls').find('.nd_colvis-checkbox').remove();
|
||||
|
||||
if ( $.inArray( 'all', colvis.s.exclude ) === -1 ) {
|
||||
for ( var i=0, iLen=columns.length ; i<iLen ; i++ ) {
|
||||
if ( $.inArray( i, colvis.s.exclude ) === -1 ) {
|
||||
var button = colvis.dom.buttons.shift();
|
||||
if (columns[i]["name"] == "icon") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$(button).addClass('nd_colvis-checkbox');
|
||||
$(button).find('label').addClass('checkbox');
|
||||
$(button).find('input').attr('id', columns[i]["name"]);
|
||||
$(button).find('input').attr('name', columns[i]["name"]);
|
||||
|
||||
if (columns[i]["name"] == "c_neighbors") {
|
||||
$(button).find('span').text('Connected Devices');
|
||||
}
|
||||
|
||||
// need to re-activate tooltips on new content
|
||||
$(button).click(function() {
|
||||
$("[rel=tooltip]").tooltip({live: true});
|
||||
});
|
||||
|
||||
$('#nd_column-controls').append( button );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user