Datatable.net - Get Reordering of the columns & Get Column visible
Please add a button on the form like below
<a class="btn btn-success visiblecheck" href="javascript:void(0);" id="visiblecheck" value="test">visiblecheck</a>
Here is 'table' is variable of Datatable.net like
var table = $('#example').dataTable();
$('.visiblecheck').click( function () {
alert(table.colReorder.order() );
var columnvisible = '';
for (i = 0; i < table.columns().count(); i++) {
if (columnvisible != '') {
columnvisible += ',';
}
if (table.column(i).visible() === true) {
columnvisible += '1';
}
else {
columnvisible += '0';
}
}
alert(columnvisible);
});
alert(table.colReorder.order()
var columnvisible = '';
for (i = 0; i < table.columns().count(); i++) {
if (columnvisible != '') {
columnvisible += ',';
}
if (table.column(i).visible() === true) {
columnvisible += '1';
}
else {
columnvisible += '0';
}
}
alert(columnvisible);
});
table.colReorder.order() - this will return the ordering of columns
No comments:
Post a Comment