简体   繁体   中英

Multi column filter in DataTables(bootstrap)

I am using the DataTables API for my table in the application. 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 . Even if I enter value for Column1 it doesn't search.

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

i guess fnFilter will also accepts iColumn paramter

so try using like this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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