I want to add
foundNodes = $( this.treeIDMap.igTree( "findNodesByText", "test1") )
+
foundNodes = $( this.treeIDMap.igTree( "findNodesByText", "test2") )
Seems that the return is an object not a list, so there is some proprietary magic in here. Maybe the objects are listed under one main object by id? So what is the best way to add the two results.
that does the job, thx.
Hello seang,
Thank you for your reply and apologies for my mistake. The created objects are not arrays, I have created a sample in how such multiple queries can be combined together at:
http://jsfiddle.net/26pSL/4/
function getNodes() { foundNodes = $( $("#tree").igTree( "findNodesByText", "North America") ); foundNodes1 = $( $("#tree").igTree( "findNodesByText", "South America") ); var results = []; for (i=0; i < foundNodes.length; i++) { results.push( foundNodes.get(i)); } for (i=0; i < foundNodes1.length; i++) { results.push(foundNodes1.get(i)); } alert(results.length); }
function getNodes() {
foundNodes = $( $("#tree").igTree( "findNodesByText", "North America") );
foundNodes1 = $( $("#tree").igTree( "findNodesByText", "South America") );
var results = [];
for (i=0; i < foundNodes.length; i++) {
results.push( foundNodes.get(i)); }
for (i=0; i < foundNodes1.length; i++) {
results.push(foundNodes1.get(i)); }
alert(results.length); }
Hope this helps.
sure that makes sense and I agree but the browser does not.
TypeError: foundNodes.concat is not a function
Since this is not really an array and more like an object the concat is not recognized.
alert( typeof foundNodes ); // gives me object.
concat is for arrays not objectshttp://www.w3schools.com/jsref/jsref_concat_array.asp
The igTree returns an array of individual item objects, for instance if one item is returned the result would look similar to: