【问题标题】:How to insert columnfilter in bootstrap datatable如何在引导数据表中插入列过滤器
【发布时间】:2016-08-11 06:10:59
【问题描述】:

我已将我的 html 表与数据表绑定,并且搜索、分页和排序等功能运行良好。但是当我尝试使用

实现列过滤器时
$('#table1').DataTable().columnFilter();`

它不起作用。它显示一个错误说

columnFilter 不是函数。

【问题讨论】:

标签: javascript jquery datatables


【解决方案1】:

我以不同的方式做到了。

$('#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();
            });
        });

} );

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-05
    • 2017-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多