Custom search: Hide matched results

Custom search: Hide matched results

kwiskokwisko Posts: 4Questions: 0Answers: 0
edited February 2014 in General
Hi. I was searching the forum but I couldn't find anything that might help me or give me some clue what to do.

I have a custom search field (placed somewhere in my layout) with couple of search modes: highlight term, show matched results and hide matched results. Switching search modes and first 2 modes I'll handle myself. For the "show matched results" mode (basically native DT's functionality) I've used this piece of code (as mentioned in documentation). [code]$resultsTable.search(searchValue).draw();[/code]

Now I have to implement hiding of matched results - for example if I enter "london" I need to hide all rows containing term "london".

Can I achieve this with a search() function somehow (maybe with some custom regex) or I have to make some new plugin for this.

Any comment or some other clue will be valuable for me. Thanks.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You could use a negative regular expression string match. See for example this SO post: http://stackoverflow.com/questions/406230/regular-expression-to-match-string-not-containing-a-word

    Allan
  • kwiskokwisko Posts: 4Questions: 0Answers: 0
    Thanks Allan! In the meantime I've solved this just the way you suggested.
This discussion has been closed.