我無法使用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中加載。它只樣之後,我對任何過濾器點擊
它拋出一個錯誤。你有沒有其他解決方案? – Onera
@Onera,你使用的是jQuery DataTables 1.10還是1.9?你在控制檯中遇到什麼錯誤? –
我收到錯誤說搜索不是一個函數,所以我是它不是數據表1.10,我試着用你最新的代碼 - 值正在清除,但數據表沒有繪製,我點擊過濾器後,它正在加載 – Onera