0
votes

I'm developing logs viewer web program with Vue.js I receive log data with ajax and display it with Slickgrid.

What i need to do is highlighting keyword after searching. I found some examples highlighting whole cells or row but couldn't find highlighting specific keyword in cell.

ex)When i search a word 'cat', slickgrid shows cells which include 'cat'. And i need to highlight the word 'cat' in the cell.

Anyone knows how to do this? or any examples??

Thank you.

1

1 Answers

1
votes

You'll need to write a custom formatter. See here for an example page. Make sure you're using the 6pac repo - it's up to date, the MLeibman repo is unmaintained now.

Re highlighting a word, you'll need to return HTML from the formatter, and just have a special span to hilight the word, eg:

we will build a <span class="hilight">wall<span/>

It's a tricky business finding a full word, that is making sure it's not part of another word, if that's what you want eg.

did you buy the <span class="hilight">wall<span/>paper yet?

That's a whole 'nother Google search in itself.