我已经将我的 html 表与数据表绑定(bind)在一起,搜索、分页和排序等功能运行良好。但是当我尝试使用
实现列过滤器时$('#table1').DataTable().columnFilter();`
这不起作用。它显示一个错误,指出
columnFilter is not a function.
最佳答案
我用不同的方式做到了。
$('#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 - 如何在引导数据表中插入列过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38888498/