Example: Treeview with highlight search term

7 posts, 0 answers
  1. Richard
    Richard avatar
    149 posts
    Member since:
    Feb 2012

    Posted 26 Apr 2012 Link to this post

    Hello All:

    I wrote fiddle http://jsfiddle.net/RichardAD/QfDd9/ to demonstrate how a portion of a node text value can be highlighted when it matches a search term. Could also be tweaked to hide non-matching nodes.

    I'm looking for feedback on the technique and improvements.

    Thanks,
    Richard
  2. Ambica
    Ambica avatar
    14 posts
    Member since:
    May 2012

    Posted 11 May 2012 Link to this post

    Hi Richard,

    its a nice post.I loved it.it saved my valuable time..
    is it possible to expand matched node and collaps non-matched nodes ??
  3. Richard
    Richard avatar
    149 posts
    Member since:
    Feb 2012

    Posted 11 May 2012 Link to this post

    Hi Ambica:

    This fork shows how to expand to the matching nodes and collapse non-matching.

    http://jsfiddle.net/RichardAD/FUW4A/ 


  4. David
    David avatar
    7 posts
    Member since:
    Oct 2011

    Posted 22 Aug 2012 Link to this post

    Excellent examples.  Thanks!
  5. Matt
    Matt avatar
    11 posts
    Member since:
    Apr 2013

    Posted 21 Oct 2013 Link to this post

    Hi RichardAD,

    Thanks for your solution. It is working like a charm.

    However, I just want to extend the same little bit. Can we highlight all occurrences of the search term in node text, instead of only first occurrence ?

    http://wowmotty.blogspot.in/2011/10/get-all-indexof-search-string.html
    This may help you to get all indexes of the occurrences in the text.

    Thanks in advance.

    Waiting for your reply.
  6. Richard
    Richard avatar
    149 posts
    Member since:
    Feb 2012

    Posted 06 Dec 2013 Link to this post

    Hi Matt:

    The sample code has been updated to highlight all match occurrences.

    Richard
  7. Matt
    Matt avatar
    11 posts
    Member since:
    Apr 2013

    Posted 23 Dec 2013 Link to this post

    Hi RichardAD,

    Thanks for your reply.

    Your solution is working like a charm.

    Thank you so much.
Back to Top