DataTable search to simulate tableClick when search results == 1
DataTable search to simulate tableClick when search results == 1
Hello,
I have a DataTable, when I type in the Search box the number of items in the table reduces to those that match as expected. What I am trying to do is when the text in the search box matches 1 table value only and the user presses the Enter key I wish for it to simulate a tableclick() call on the one item displayed in the DataTable. Is it possible to know the number of rows in the table that the search has matched after an Enter key press?
Is simulating a tableClick() possible?
Currently when a user mouse clicks on a table entry it will run this:
function tableClick() {
var data = locTable.row(this).data();
}
This is what I have so far:
$('#locTable_filter input').bind('keyup', function(e) {
if(e.keyCode == 13) {
}
});
Thank you very much
This question has an accepted answers - jump to answer
Answers
You could use events to determine the table size after the search - take a look at
draw
orsearch
, one of those should do the trick for you,Colin
My Answer: