>我有这种类型的带有自定义选择过滤器的表格
https://jsfiddle.net/cvLdunzx/
<div class="col-lg-3 pull-right">
<select class="form-control">
<option value="1">First</option>
<option value="2">Second</option>
<option value="3">Third</option>
</select>
</div>
<table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>2012/03/29</td>
<td>$433,060</td>
</tr>
</tbody>
</table>
var table = $('#example').DataTable();
我想像这样显示自定义选择附近的搜索框
http://s33.postimg.org/x6vh0o9ov/img.png
如何添加到table_wrapper> table_filter?
您可以使用 dom/sdom 属性对其进行自定义。
https://datatables.net/reference/option/dom
你可以做一些像这样的事情:
$('#example').DataTable( {
responsive: true,
"dom": '<"wrapper"f<"test">lipt>' // creates a div with class test
} );
$('.test').append("<select><option>1</option></select>");
https://jsfiddle.net/calinaadi/n8m0a49p/1/