Zach
Zach

Reputation: 327

datatable column.search() is not filtering my table using

I've created a simple search but it's not filtering, I'm using datatable plug-ins. I don't know what did I missed in my script.

<input type="text" id="txtserial" name="txtSerial" class="form-control" />

Here's my javascript:

var dtmyJob = $('#myJob').DataTable({
     "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
     iDisplayLength: -1,
     sScrollY: "40vh",
     bScrollInfinite: true, //this property disables pagination
     "scrollCollapse": true,
     "paging": false,
     "bInfo": false,
     "bFilter": false,
     "bSort": false
 });

 $("#txtserial").on('keyup', function () {
     dtmyJob.columns(2).search(this.value).draw();
     alert(dtmyJob);
 });

Upvotes: 3

Views: 1267

Answers (1)

Gyrocode.com
Gyrocode.com

Reputation: 58860

Remove bFilter: false because you have disabled searching ability and that's why searching with columns().search() doesn't work.

Use dom option if you just want to hide the search box.

For example:

'dom': 'lrtip'

Upvotes: 1

Related Questions