PDA

View Full Version : [OPEN] [#207] How to add a node with children



jchau
Apr 13, 2013, 4:30 AM
This worked in 1.x. I want to add a node with children to a tree. The new node contains 1 child but when added, it shows two children with the same id. What am I doing wrong?



<html>
<head>
</head>
<body>
<script type="text/javascript">
function addStuff() {
TreePanel1.getRootNode().appendChild([{
id: 'item1',
text: 'item1',
expanded: true,
children: [{
id: 'item1A',
text: 'item1A',
children: [],
leaf: true
}]
}]);
}
</script>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug" Theme="Gray"
DisableViewState="true" Namespace="" />
<ext:TreePanel ID="TreePanel1" runat="server" Width="300" Height="450" Icon="BookOpen"
Title="Catalog" AutoScroll="true">
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button runat="server" Text="Add Stuff" Handler="addStuff();">
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Root>
<ext:Node Text="Composers" Expanded="true">
<Children>
<ext:Node Text="Beethoven" Icon="UserGray">
<Children>
<ext:Node Text="Concertos">
<Children>
<ext:Node Text="No. 1 - C" Icon="Music" Leaf="true" />
<ext:Node Text="No. 2 - B-Flat Major" Icon="Music" Leaf="true" />
<ext:Node Text="No. 3 - C Minor" Icon="Music" Leaf="true" />
</Children>
</ext:Node>
</Children>
</ext:Node>
</Children>
</ext:Node>
</Root>
</ext:TreePanel>
</form>
</body>
</html>

jchau
Apr 13, 2013, 4:40 AM
A ExtJS 4.2 bug.

http://www.sencha.com/forum/showthread.php?259675

Daniil
Apr 15, 2013, 4:09 AM
Hi @jchau,

Seems, @JTRipper suggests something in the "Possible fix" section. Have you tried it?

jchau
Apr 15, 2013, 1:24 PM
Yes, the possible fix worked

Daniil
Apr 15, 2013, 3:20 PM
Thank you for confirming.

We decided to commit that change as a temp fix. Though, still need to monitor the Sencha thread and wait their fix.

Created an Issue to monitor.
https://github.com/extnet/Ext.NET/issues/207