Root's children nodes were duplicated.
I was not able to reproduce that.
Please post a complete (but simplified) code sample demonstrating how to reproduce the issue.
Some more details are in our forums guidelines.
Forum Guidelines For Posting New Topics
More Information Required
Use Expand and Collapse instead, defining
recursive
parameter to
true
, as shown below:
Expand
:
http://docs.sencha.com/extjs/5.0.1/#...-method-expand
Collapse
:
http://docs.sencha.com/extjs/5.0.1/#...ethod-collapse
<html >
<head runat="server">
<script type="text/javascript">
var toggleRoot = function () {
var root = App._trp.getRootNode();
root[root.isExpanded() ? 'collapse' : 'expand'](true);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" ScriptMode="Debug" />
<ext:TreePanel ID="_trp" Title="Products" RootVisible="true" Width="300" Height="300" runat="server">
<Root>
<ext:Node Text="Root" Expanded="false">
<Children>
<ext:Node Text="Framework" Expanded="false">
<Children>
<ext:Node Text="Ext.Net" Icon="Building" Leaf="True" />
<ext:Node Text="Sencha" Icon="Building" Leaf="True" />
</Children>
</ext:Node>
</Children>
</ext:Node>
</Root>
<Buttons>
<ext:Button Text="Toggle Root" runat="server">
<Listeners>
<Click Handler="toggleRoot()" />
</Listeners>
</ext:Button>
</Buttons>
</ext:TreePanel>
</form>
</body>
</html>
You may prefer the following notation:
<script type="text/javascript">
var toggleRoot = function () {
var root = App._trp.getRootNode();
if (root.isExpanded()) {
root.collapse(true);
}
else {
root.expand(true);
}
}
</script>