Disabling search and ordering on individual column searching table(select inputs)
Disabling search and ordering on individual column searching table(select inputs)
f4seth
Posts: 3Questions: 2Answers: 0
I am attempting to remove the search functionality and the ordering on my individual column searching table. I am not seeming to have any luck. Does anybody know how I disable this functionality from the following code?
$(document).ready(function() {
$('#example').DataTable( {
initComplete: function () {
this.api().columns().every( function () {
var column = this;
var select = $('<select><option value=""></option></select>')
.appendTo( $(column.footer()).empty() )
.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>' )
} );
} );
}
} );
} );
This discussion has been closed.
Answers
To disable the user's ability to order particular columns you will use
columns.orderable
.You can assign a class to columns you want to sort. Here is an example:
http://live.datatables.net/pesezaqe/1/edit
Kevin