Highlight on datatable when perform search

Highlight on datatable when perform search

spiderkznspiderkzn Posts: 44Questions: 12Answers: 0

Hi,

I need to highlight on specific column while searching without search the whole datatable?

I have tried use https://datatables.net/blog/2014-10-22 but it not working.

Or can I disable highlight search on whole datatable?

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you link to a page showing the issue please? It works in the example you link to, although that is an older version of DataTables, so perhaps something needs updating somewhere. A link to a test case showing the problem would help me resolve it.

    Allan

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    To highlight specific columns you can use columns.className to apply a classname for highlighting then update the selector used to highlight to include the classname, for example:

    var body = $( '.search-hilite', table.table().body() );
    

    Here is a running test case highlighting only the Position column:
    https://live.datatables.net/liqoxife/1/edit

    Kevin

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Doh, thank you Kevin. I misunderstood the question!

    Allan

Sign In or Register to comment.