I looked through the documentation but I haven't been able to find a way to add a double-click event/function to the search box. I would like to clear the search box filter with a double click. Can anyone help?
Just add it using jQuery? $('input div.dataTables_filter').dblclick( function () { $(this).val(''); $(this).keypress(); } );. (the keypress call will cause DataTables to run the filter again).
Thanks again Allan. The code that you left cleared the search box but it didn't reset the table results. I added "oTable.fnFilter('');" to the code as shown below and it works great.
Replies
Allan
$(document).ready(function () {
$('#example').dataTable();
$('input div.dataTables_filter').dblclick(function () { $(this).val(''); $(this).keypress(); });
});
[code]
$(document).ready(function () {
$('#example').dataTable();
$('div.dataTables_filter input ').dblclick(function () { $(this).val(''); $(this).keypress(); } );
});
[/code]
Allan
$('div.dataTables_filter input ').dblclick(function () { $(this).val(''); $(this).keypress(); oTable.fnFilter(''); });