我有一个HTML页面,头部内有一些脚本,我有一个ID = example的DataTable和一个按钮id =“btnFilter”,它应该过滤数据DataTable基于用户在其他人内部输入的内容“输入文本标签”。 我尝试了很多互联网上的变化,但我无法做任何可以做我想做的事情。使用输入文本客户端过滤数据表
这是我的HTML,我有输入和标签标记,当用户将输入想过滤的文本:
<table id="filterLog" class="table table-striped">
<thead>
<h4>Table</h4>
</thead>
<tfoot>
<th>
</th>
</tfoot>
<tbody>
<tr>
<td><label class="input-group">From:</label></td>
<td><label class="input-group">To:</label></td>
<td><label class="input-group">Created:</label></td>
<td><label class="input-group">Comp:</label></td>
</tr>
</tbody>
<tr id="linhasFiltro">
<td><input class="form-control" type="date" id="date1" /></td>
<td><input class="form-control" type="date" id="date2" /></td>
<td><input class="form-control" type="text" id="creator" maxlength="15" /></td>
<td><input class="form-control" type="text" id="cLog" maxlength="10"/></td>
</tr>
<tr>
<td colspan="4"><label class="input-group">Type:</label></td>
</tr>
<tr>
<td colspan="1">
<select id="tipoLog" class="form-control">
<option>Error</option>
<option>Test</option>
<option>Info</option>
</select>
</td>
<td><input type="button" value="Filter" id="btnFilter" class="btn btn-primary" /> <input type="button" id="btnExport" value="Exportar" class="btn btn-primary" /></td>
</tr>
<tr class="border:0px;">
<td colspan="6" id="consiError" ></td>
</tr>
</table>
和所有我想要的是,当输入ID内的用户类型=“cLog”,然后单击btnFiltrar,DataTable必须显示列中相同文本的所有行。
THX家伙