I tried using the findNodesByText to find a string contained in a node. To my great surprise it only search an exact match?
[I'm a node]
var nodes = this.treeIDMap.igTree( "findNodesByText", "I'm a" );// -> Found nothing
var nodes = this.treeIDMap.igTree( "findNodesByText", "I'm a node" );// -> Found the node
var nodes = this.treeIDMap.igTree( "findNodesByText", "node" );// -> Found nothing
Why would that be? So figuring this is only an exact match I'm trying to code a function to do what I need.
------------Here is one way to do it I guess ---------
var foundNodes = new Array(); filter = filter.toLowerCase(); findInObject = function( obj, prop, val )//go as deep as posible and find a match { if ( obj !== null && obj.hasOwnProperty( prop ) && obj[prop].toLowerCase().indexOf(val) > -1 ) { return obj; } else { for ( var s in obj ) { if ( obj.hasOwnProperty( s ) && typeof obj[s] == 'object' && obj[s] !== null ) { var result = findInObject( obj[s], prop, val ); if ( result !== null ) { return result; } } } } return null; } for ( var i = 0; i < this.treeData.length; i++ )//use the internal copy of the data to do the search and only modify the live { if ( findInObject( this.treeData[i], "ITEM", filter ) ) foundNodes.push( this.treeData[i] )//does the node have a match in it anywhere? } this.treeIDMap.igTree( { dataSource: foundNodes } ); this.treeIDMap.igTree( "dataBind" );
still would like it faster.
Your welcome, I'm just not built that way. Feedback is a must imo.
Hi seang,
Thanks for the feedback! Usually people write us back only if the things don't work as they expected them to :)
the fix works well.
I use nuget for updates via the command prompt but i'd like to download the entire package and management it myself. Does nuget have a repository that I can download from the net? I just dont use it enough.
Hi Seang,
The fix would be available on NuGet with the next service release (we now have trial packages and free igGrid packages available on NuGet and we update them every service release). The next SR is scheduled to be the last week of June.
I hope this helps!