Support » Plugin: TablePress » How to highlight the search term within the row

  • Resolved blackan

    (@blackan)


    Hi, I would like to know if it’s possible to highlight the search term (the actual word or words that were searched for) within the rows that are displayed after a search?

    Each row in my table contains a different issue of a journal, and one of the cells lists all of the articles in that issue (around 10 articles, including title and author). Which means that when someone searches for a particular author, for example, each issue that contains an article by that author will be displayed. But it takes some time to find the article that that particlar author wrote, as it’s crowded out by all the other articles!

    It would be GREAT if the search term (in this case the author’s name) was highlighted within that row so that they could quickly see if it was of interest.

    Is this possible?
    Many thanks.

    P.S. – My site is not yet live, so I can’t post a URL…

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    For this, you can use the TablePress Extension from https://tablepress.org/downloads/extensions/tablepress-datatables-search-highlight.zip
    Just download, install, and activate the Extension from the ZIP file as a new
    WordPress plugin and activate it. Then, just add a new parameter `datatables_search_highlight=true

    
    to the Shortcode for each table that should get the highlighting:
    

    [table id=123 datatables_search_highlight=true /]
    `
    (with the correct table ID).

    Regards,
    Tobias

    Thread Starter blackan

    (@blackan)

    It works! So easy to implement, thanks a million! 🙂

    This extension wasn’t listed on your extensions page – if it was I wouldn’t have bothered you, so you might like to add it there?

    Thanks again,
    Anna

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂 Good to hear that this helped!
    Yes, I should probably add the Extension there, good point!

    Best wishes,
    Tobias
     
    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.