简体   繁体   English

DataTables中的多列过滤器(引导程序)

[英]Multi column filter in DataTables(bootstrap)

I am using the DataTables API for my table in the application. 我正在为应用程序中的表使用DataTables API。 I have a scenario where I want multiple columns be enabled for filtering purpose. 我有一种情况,我希望启用多个列以进行过滤。

I have this code setup now. 我现在有此代码设置。 But it only searches for Column2 . 但是它仅搜索Column2 Even if I enter value for Column1 it doesn't search. 即使我为Column1输入值,它也不会搜索。

    $('#btnFilter').click(function () {
        table.fnFilter($('#Column1').val());
        table.fnFilter($('#Column2').val());
    });

i guess fnFilter will also accepts iColumn paramter 我想fnFilter也将接受iColumn参数

so try using like this 所以尝试这样使用

table.fnFilter($('#Column1').val(), 0);  //0 is the first column
table.fnFilter($('#Column2').val(), 1);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM