I ve a huge datatable with too much column, i ve filtering some
$(document).ready(function() {
var table = $('#example').DataTable( {
"bJQueryUI": false,
"bAutoWidth": false,
"bDestroy": true,
// "bPaginate": false,
// "bInfo": false,
"lengthMenu": [ [30, 40, 50, -1], [30, 40, 50, "All"] ],
"columnDefs": [
{ "visible": false, "targets": [4] }, //OSversion
{ "visible": false, "targets": [8] }, //VmVersions
{ "visible": false, "targets": [7] }, //VMStates
{ "visible": false, "targets": [6] } //VMtoolsVersion
],
} );
$('input.toggle-vis').on( 'click', function (e) {
e.preventDefault();
// Get the column API object
var column = table.column( $(this).attr('data-column') );
// Toggle the visibility
column.visible( ! column.visible() );
} );
} );
I want to add some checkbox to see which column i can add or remove, i ve try :
$log .= '<div> Toggle column: <table id="check1"><tr>';
my $j=0;
foreach $toogle (@logvmware)
{
$log .= '<td><input type="checkbox" class="toggle-vis" data-column="'.$j.'"><FONT COLOR="#FF3333">'.$toogle.'</FONT></td>';
if ($j eq 6) {$log .= "<tr>";}
$j++;
}
$log .= '</table> </div>';
My checkbox correctly add or remove column, but they re always empty !! I want them to be check if column is prompt and unchecked if column is hiding ...
I hope i was clear, i am not fluent english.
Thanks
Aucun commentaire:
Enregistrer un commentaire