Get column name
Get column name
Hi, I would like to add name of the column in label.
$(document).ready(function() {
$('#example1').DataTable( {
"order": [[ 0, "desc" ]],
initComplete: function () {
this.api().columns('.select-filter').every( function () {
var column = this;
var select = $('<select class="form-control input-sm"><option value="">All</option></select>')
.appendTo( 'div.dataTables_length' )
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
select.wrap( '<label> Filter: </label>' )
} );
}
} );
} );