我已经将我的html表与数据表绑定在一起,并且诸如搜索,分页和排序之类的功能运行良好。但是当我尝试使用实现列过滤器时
$('#table1').DataTable().columnFilter();`
它不起作用。显示错误信息
columnFilter不是函数。
最佳答案
我以不同的方式做到了。
$('#demo-dt-basic thead tr th').each(function (i) {
var title = "Search "+$(this).text();
$("<input class='form-control input-sm' type='text' placeholder='" + title + "'/>").appendTo($(this));
table.columns().eq(0).each(function (colIdx) {
$('input', table.column(colIdx).header()).on('keyup change', function () {
table
.column(colIdx)
.search(this.value)
.draw();
});
});
} );
关于javascript - 如何在引导数据表中插入columnfilter,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38888498/