Search filter API
Search filter API
dylanmac
Posts: 49Questions: 7Answers: 1
I'm trying out DT 1.10 beta. It looks great but I am not sure how to construct a multi-column filter with smart filtering turned off. Is it like so?
[code]
$('#table').DataTable().columns( col1Index,col2Index ).search( filterValue1 [[false]], filterValue2 [[false]] ).draw();
[/code]
[code]
$('#table').DataTable().columns( col1Index,col2Index ).search( filterValue1 [[false]], filterValue2 [[false]] ).draw();
[/code]
This discussion has been closed.
Replies
[code]
$('#table').DataTable()
.column( col1Index ).search( filterValue1, false )
.column( col2Index ).search( filterValue2, false )
.draw();
[/code]
Allan
I love the new API. Really excellent work. Thank you. I will have to convince our architect to let us release our app using "beta" software but the proof is in the pudding: I have not encountered any bugs so far.
So I am trying to add a search reset link for my table but it doesn't seem to be working. It's possible that some of my functions are colliding but there are no console errors. here's how I'm calling it:
$('#productListTable').DataTable().search('').draw();
When I pass in an actual value within the quotes it filters just fine. I didn't see anything in the search() API that covers this use case.
Thank you!
> Please be aware that this method sets the search to apply to the table only - it does not actually perform the search. In order to have the search performed and the result shown, use the draw() method, which can be called simply as a chained method of the search() method's returned object - for example table.search( 'Fred' ).draw();. This is to provide the ability to queue multiple changes before performing a draw.
Allan
Was this answer for me or jolyon2000?
When trying to "reset" the table to display all records I have tried the following:
$('#productListTable').DataTable().search('').draw(); // empty string
$('#productListTable').DataTable().draw(); // doesn't work but no JS error either
Not sure what else to try.
Dylan