datatable过滤HTML,datatables – 具有多选下拉列表的数据表特定列过滤器

经过长时间的搜索,我找到了解决方案.

其实这很简单.以下是我对此选项的修复,

已经有一个选项可以根据以下链接搜索特定的列虎钳,

// DataTable

var table = $('#example').DataTable();

// 2 is column id

// "India" is search string

table.column( 2 ).search( 'India' ).draw();

So the above one will search for "India" in a specific column "2" (Say like "Country" column)

Here i need an ability to search for more than one country like "India, Japan etc.,"

So the code will be as follows,

// DataTable

var table = $('#example').DataTable();

// 2 is column id

// "India|Japan|Spain" is search string

table.column( 2 ).search( 'India|Japan|Spain', true, false ).draw();

Updated: We need to add two more parameters in the "search()" function.

search(val_1,val_2,val_3)

where,

val_1 is search string with "|" symbol seperated. So it contains regular express chars as per the example.

val_2 is true (To enable regular express in the search)

val_3 is false (To disable smart search. default is true)

所以我在搜索字符串之间添加了一个“管道”符号:p LOL

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值