You might want to also have a look at this plug-in which demonstrates how you can bind your own event handler to the input search box: http://datatables.net/plug-ins#api_fnSetFilteringDelay
for some reason, I'm able to get the input value as you described above, but I can't get my code to detect any changes to that text field. I thought perhaps it was because there's no "" defined around the input, but I added that in in the main datatables code and it didn't make a difference.
For example, I tested this function:
[code]
$('input[type="text"]').focus(function() {
alert('focus!');
});
[/code]
The event fires properly for text fields within another form on the same page, but when I click on the dataTables search input text box, nothing happens.
$(.whatever).dataTable();
[/code]
The text input element that DataTables uses is dynamically generated - so it might be missing your event assignment. Visual Event ( http://www.sprymedia.co.uk/article/Visual+Event ) would confirm if this is the case.
Replies
should do it :-)
Alternatively, if you want the last search for value you can use oTable.fnSettings().oPreviousSearch.sSearch.]
Hope that helps,
Allan
for some reason, I'm able to get the input value as you described above, but I can't get my code to detect any changes to that text field. I thought perhaps it was because there's no "" defined around the input, but I added that in in the main datatables code and it didn't make a difference.
For example, I tested this function:
[code]
$('input[type="text"]').focus(function() {
alert('focus!');
});
[/code]
The event fires properly for text fields within another form on the same page, but when I click on the dataTables search input text box, nothing happens.
Any ideas?
Thanks much,
ALison
Are you adding the event before DataTables is initialised? For example:
[code]
$('input[type="text"]').focus(function() {
alert('focus!');
});
$(.whatever).dataTable();
[/code]
The text input element that DataTables uses is dynamically generated - so it might be missing your event assignment. Visual Event ( http://www.sprymedia.co.uk/article/Visual+Event ) would confirm if this is the case.
Regards,
Allan