column.search() is not filtering my table
column.search() is not filtering my table
btgomez
Posts: 14Questions: 6Answers: 0
Can you please check what did I missed in my datatable. I've created a simple search but it's not filtering.
<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);
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Try using
column().search()
instead ofcolumns().search()
. The second option is used to search across multiple columns, in your example you seem to be trying to search only one column.Is the issue. That disables filtering (searching), so
column().search()
has no effect (since it is disabled!).My guess is that you want to remove the default global search input - you need to use
dom
for that, notsearch
(which is what the legacy bFilter option maps to).Allan
@allan, in this case, the use of
column().search()
is still valid right?If you remove the
f
from thedom
option then yes its still valid.If you disable searching using
bFilter: false
or using the equivalentsearching
thencolumn().search()
won't perform the search.Kevin
Thanks @kthorngren, nice to know that.