search exact match and highlight jquery datatable regex

后端 未结 3 791
抹茶落季
抹茶落季 2020-12-11 04:38

In jquery datatable, I have to filter the result with exact match and highlight it. for exact match I am trying following code but it does not work. fiddle

t         


        
3条回答
  •  囚心锁ツ
    2020-12-11 05:27

    Try

    $('#search-inp').keyup(function(){
        var key = $(this).val();
        var regExp = "."
        if (key)
            regExp = "^\\s*" + key + "\\s*$";
    
        table.columns(1).search(regExp, true).draw();
    });
    

    When search key is empty always set it to . matches any in regex.

提交回复
热议问题