This is a migrated thread and some comments may be shown as answers.

Example: Treeview with highlight search term

6 Answers 851 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 26 Apr 2012, 09:18 PM
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

6 Answers, 1 is accepted

Sort by
0
Ambica
Top achievements
Rank 1
answered on 11 May 2012, 11:57 AM
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 ??
0
Richard
Top achievements
Rank 1
answered on 11 May 2012, 06:29 PM
Hi Ambica:

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

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


0
David
Top achievements
Rank 1
answered on 22 Aug 2012, 05:27 PM
Excellent examples.  Thanks!
0
Matt
Top achievements
Rank 1
answered on 21 Oct 2013, 01:36 PM
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.
0
Richard
Top achievements
Rank 1
answered on 06 Dec 2013, 11:01 PM
Hi Matt:

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

Richard
0
Matt
Top achievements
Rank 1
answered on 23 Dec 2013, 06:20 AM
Hi RichardAD,

Thanks for your reply.

Your solution is working like a charm.

Thank you so much.
Tags
TreeView
Asked by
Richard
Top achievements
Rank 1
Answers by
Ambica
Top achievements
Rank 1
Richard
Top achievements
Rank 1
David
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Share this question
or