Datatable searching

Datatable searching

pankajdpankajd Posts: 4Questions: 4Answers: 0
edited March 2015 in Free community support

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

  • rrkumarrrkumar Posts: 4Questions: 1Answers: 0

    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
    }
    ]
    } );

  • allanallan Posts: 61,771Questions: 1Answers: 10,112 Site admin

    Remove the options you don't want from your sDom parameter.

    Allan

This discussion has been closed.