我无法使用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[type="text"]').val('');
但问题是,它正在清除值,但数据未加载到dataTable中。只有在我点击任何过滤器
后才会加载答案 0 :(得分:0)
您可以使用
var table;
$(document).ready(function() {
table = $('#your_table').DataTable();
});
$('#id_btn').on('click', function(){
table.search( '' ).columns().search( '' ).draw();
});