ExtJS 4 TreePanel hide nodes?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
24 views
Hello. Tell me who knows, I fight the second day, re-read already all that is possible.


Have a TreePanel and a textfield.

When the user enters something in the text box, the tree should be filtered and leave visible only those nodes whose title contains the entered text.


Similar situation with the grid was solved simply — filtering, store. But TreeStore has no method filter. How to hide the node. The network has found several solutions, but they were all for ExtJS 3.


Question actually in how to filter a TreeStore on the client or how to hide tree node (will filter itself then). The impression that I fantastically blunt, the problem must be solved by some simple and understandable way.
by | 24 views

2 Answers

0 like 0 dislike
Found in fact, the only working option here:
\rwww.sencha.com/forum/showthread.php?142704-Show-Hide-of-the-tree-node-in-ExtJS-4
\r
But the man himself says:
"This is a bit janky and probably unsupported but this is the current workaround I have for hiding a single node. "
\r
Here is the solution:
\rsetNodeVisible: function(nodeId, visible) {
var node = this.getNodeById(nodeId),
view = this.getView(),
el = Ext.fly(view.getNodeByRecord(node));
\r
el.setVisibilityMode(Ext.Element.DISPLAY);
el.setVisible(visible);
},

\r
But that is just a little unrealistic crutch. Is there no normal way to do such a simple operation :(
by
0 like 0 dislike
It's not very simple operation, it is not clear what to do with the child nodes if the root is filtered out. But in any case ExtJS4 API says that the configs from Ext.data.TreeStore is filters. If for some reason you don't like it, you can always just recursively traverse the tree and hide/show all you need.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
asked Apr 24, 2019 by Mysterion
110,608 questions
257,186 answers
0 comments
38,662 users