Skip to main content

Posts

Showing posts with the label DataTable.js

Datatable.net - Get Reordering of the columns & Get Column visible

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';             }  ...

DataTable.js, Change the Color of Row based on the Cell Value

DataTable.js, Change the Color of Row based on the Cell Value Suppose you wants to change the color of Table Row on the bases of column value, then we have to use  rowCallback as the below code rowCallback: function (row, data, index) {             if (data[3] ==="some value") {                 $(row).css('color', 'red');             }                     } This code should be used like the below: var table = $('#TableName').DataTable( {         'paging': true,         'lengthChange': true,         'searching': true,         'ordering': true,         'info': true,         'autoWidth': false,         'ajax': 'JsonData.json',         'columnDefs': [{  ...