Title: Hide property for tree nodes Post by: fl0 on May 07, 2013, 01:30:59 AM Hello again,
still working with your nice tree. As you know from the bugs forum i kinda use everything it has to offer ;) Now i'd have a little featurewish for the tree. Could you implement a "hidden" property, which determines whether a node is displayed in the tree or not. I've an inputfield to search for values in the tree with the following functions: $('#search').keyup(function() { $('#tree').tree('collapseAll'); //$('#tree').tree('hideAll'); var root = $('#tree').tree('getRoot'); find($('#tree'), root, $('#search').val()); }); function find(tree, node, needle) { var children = tree.tree('getChildren', node.target); var found = false; $.each(children, function(key, value) { found = find(tree, value, needle) || found; }); if (found || node.text.indexOf(needle) !== -1) { tree.tree("expand", node.target); //tree.tree("unhide", node.target); return true; } return false; } By now it collapses the tree and expands all nodes where a specific string is found. My problem is that the tree i work an is really really large and almost every node has a hell of a lot subnotes. So whenever i search for a string, all nodes, that have a parent on the path are displayed. I would basicly need the following functions: tree("hideAll") tree("unhide", node) for completeness i recommend also tree("unhideAll") tree("hide", node) Is it possible that you include such a feature in the future? Also feel free to use my code for a tree("findString", node, needle) function ;) Thanks in advance Title: Re: Hide property for tree nodes Post by: stworthy on May 07, 2013, 02:03:18 AM The 'hide' and 'unhide' methods can be extended as:
Code: <script> The code below shows how to hide the selected node. Code: var node = $('#tt').tree('getSelected'); Title: Re: Hide property for tree nodes Post by: fl0 on May 08, 2013, 12:43:29 AM Works perfect. Thx.
Will this be implemented in the next release? |