How to remove the search string added programmatically in the search box ?
How to remove the search string added programmatically in the search box ?
Hi All ,
I have a table like http://legacy.datatables.net/index and I have added a drop down on the form (somewhere on the form). When user select the option in drop down on 'Onchange' event , I am searching on the table by using the api
oTable = $('#servers-table').dataTable();
oTable.fnFilter( $( "#engagement_list option:selected" ).text() );
But when I do this way the search box is populated with the option selected in the drop-down. I wanted to keep the search box as it is and remove the content auto-populated But the result should show all the filtered records. Is this possible ?
Answers
You could use
$('#myTable input[type=search]').val('')
to remove the search term. But it is worth noting that there is only one global search value. As soon as the user types into the input it would remove any global filter you set programmatically.Allan