Hi All,
We have one requirement need to Searchable igtree. So anyone can help me on this. already we have done treeview which contains checkbox with data and want additional feature for filtering data as we have large data.
Thanking You,
Santosh Srinivas G
Hello,
There is a search functionality implemented for the igTree Nodes and exposed via the API. For reference you could take a look at the following forum thread: Search in the Tree, as well as these igTree API methods: findImmediateNodesByText, findNodesByText. You could use these methods to obtain a collection of the nodes matching the search text condition.
Please notice the parent nodes are optional for these methods, so you could omit them and make a search through the whole igTree nodes collection.
For example, it is possible to get all of the Nodes matching the search condition using something like:var matchedNodes = $("#tree").igTree("findNodesByText", "search condition here"); You could additionally use this collection to implement the required functionality.
Hi Ivaylo Ganchev,
Thanks for response.
I appplied your code. After getting matchedNodes, i Converted to JSON.stringify(matchedNodes). Here by i am getting the data like this.
[{"path":"0_0","element":{"0":{},"length":1,"prevObject":{"0":{},"context":{},"length":1},"context":{}},"data":{"ItemName":"CCL","ID":1},"binding":{"textKey":"ItemName","valueKey":"ID","nodeContentTemplate":"<b style='color:ActiveCaption;font-size:x-small'>${ItemName}</b>"}}]
How can i get of "data":{"ItemName":"CCL","ID":1} value? I want CCL from abive code. Please help on this.
Well, it is possible to search in the result string for a particular pattern. However, you could consider accessing this data from the object itself before using the JSON.stringify, as it will be more convenient.
Additionally, it is worth to note in case you have a valid JSON, it is possible to use a similar to the following approach :
$(function() { var json = { "people": { "person": [{ "name": "Peter", "age": 43, "sx": "male"}, { "name": "Zara", "age": 65, "sx": "female"}] } }; $.each(json.people.person, function(i, v) { if (v.name == "Peter") { alert(v.age); return; } });});
Please let me know how these suggestions work for you.
Hi,
Thanks alot for reply. It is worked for me.