Datatable searching
Datatable searching
How to make datatable search option only for one column
not other column
my code
var tconfig = {
// "sDom": '<"toolbar">hlfetlp',
"processing": true,
"serverSide": true,
"ajax": {
"url": BASE_URL + "admin/Bus_stop_master/get_bus_stops",
"type": "POST",
"datatype": "json",
"data":{}
},
"columnDefs": [
{
"searchable": false,
"orderable": false,
"targets": 1
}
],
"iDisplayLength": 5,
"aLengthMenu": [[5, 10, 50, -1], [5, 10, 50, "All"]],
"paginate": true,
"paging": true,
"aoColumnDefs": [
{
"bSearchable": false,
"aTargets": [0]
}
]
};
var oTable = $('#example').dataTable(tconfig);
Answers
Hi,
Just an Idea. Using the following method to disable searching on certain columns.
It will not search in the 2nd and 3rd column.
$('#example').dataTable( {
"columnDefs": [
{
"targets": [ 2 ],
"searchable": false
},
{
"targets": [ 3 ],
"searchable": false
}
]
} );
Remove the options you don't want from your sDom parameter.
Allan