Datatables exact word search

前端 未结 3 1945
天命终不由人
天命终不由人 2020-12-11 23:32

Hi I\'m using datatables and I would like to filter my data by an exact word.

My table data looks like below;

+-----+----------+
| num | status   |
+         


        
3条回答
  •  眼角桃花
    2020-12-12 00:15

    Hope this could help. Adding '\\b' at both end will let the table search for whole word only.

    var regex = '\\b' + searchKey + '\\b';
    .columns().search( regex, true, false).draw();
    

提交回复
热议问题