How to clear search in all tables on page
How to clear search in all tables on page
ravenna
Posts: 2Questions: 0Answers: 0
I have 2 tables on a page, loaded in tabs. They work great but I have a custom search element and am dropping the search into the Dom using jquery append().
[code]
// APPEND THE SEARCH DIV TO THE DROPDOWN LI
$('div.dataTables_filter').each(function(){
$(this).parent('.dataTables_wrapper').prev('.tableSearch').find('.search-dropdown').append(this);
});
[/code]
The first search clears fine but the second one won't clear.
[code]
// CLEAR SEARCH
$('span.clear-search').click(function(){
$('li.search-dropdown input').val("");
$('a.searchIcon .icon-filter').hide();
$('a.searchIcon .icon-search').show();
oTable.fnFilter("");
});
[/code]
I am instantiating them based on a shared class name .tablesort
http://papershare.ravennainteractive.com/d3/
[code]
// APPEND THE SEARCH DIV TO THE DROPDOWN LI
$('div.dataTables_filter').each(function(){
$(this).parent('.dataTables_wrapper').prev('.tableSearch').find('.search-dropdown').append(this);
});
[/code]
The first search clears fine but the second one won't clear.
[code]
// CLEAR SEARCH
$('span.clear-search').click(function(){
$('li.search-dropdown input').val("");
$('a.searchIcon .icon-filter').hide();
$('a.searchIcon .icon-search').show();
oTable.fnFilter("");
});
[/code]
I am instantiating them based on a shared class name .tablesort
http://papershare.ravennainteractive.com/d3/
This discussion has been closed.