我无法使用fnFilter()清除筛选器。
这是我的HTML代码:
<table id="todays _table>
<thead>
<tr id="todays_search_input_feilds">
<td class="input_filter">
<input type="text" id="type" class="form-control search_events">
</td>
<td class="input_filter">
<input type="text" id="vendor " class="form-control search_events">
</td>
</tr>
</thead>
</table>
这是我的 JQuery 代码
$('#todays_table').dataTable().fnFilter('');
oTable.fnClearTable();
我尝试了以下方法进行清除:
$('input[class="form-control search_events"]').val('');
但是这样做的问题在于,它清除了值,但数据没有加载到dataTable中。只有当我点击任何一个筛选器时才会加载。
然后重置全局搜索并重新绘制表格:$('#yourtable').DataTable().search('').draw(); - michaelf