PDA

View Full Version : [FIXED] NoteInterface.appendChild also adds the nodes to the parent list



r_honey
15 Nov 2011, 2:41 AM
Touch 2.0 Preview 2 has introduced a very important bug.
While doing a node.appendChild for a TreeStore node (e.g. node.appendChild ([items]), the same items get added to the parent list also.

Suppose I have this:

Item1
Item2

Now if I do Item2.appendChild([{text: Item3}, {text: Item4}])

I end up with the following list:

Item1
Item2
-> Item3
-> Item4
Item3
Item4

Notice how Item3 and Item 4 have been added to the parent level incorrectly.

Jamie Avins
15 Nov 2011, 8:27 AM
Thank you for the report.

r_honey
15 Nov 2011, 9:55 AM
For an update, it now looks like this was present in 2.0 - Preview 1 also, just that I did no notice it at that point.

r_honey
15 Nov 2011, 10:01 AM
And for others who face this issue, here are more details and how I work-around it.

To me it looks like the issue only occurs when the node you are appending to is the active node for the NestedList whose items are being displayed, i.e. the code above would show problem only when Item2 is the current node whose children are listed in the NestedList.

In my case, I use manual Ajax calls to fetch remote data. So when someone clicks on Item2, NestedList activates it with no children. By the time my data comes back and I append it to Item2, Item2 is active and appending results in the same children being added to one level higher also (visible when you click Back).

To work-around, I first set "leaf" to true on Item2:
Item2.set('leaf', true);

So clicking on it does not do anything (but I show a wait icon). When data comes back, I append it to Item2, make it non-leaf:
Item2.set('leaf', false);

and finally activate it manually:
nestedList.goToNode(Item2);

So it works fine for me now.

TommyMaintz
13 Jan 2012, 10:40 AM
This has been fixed as part of the data package cleanup and will be part of the next Touch 2.0 release. Please let us know if you still have issues related to this after the next release. Thanks for the report!

r_honey
13 Jan 2012, 12:03 PM
Thanks Tommy for the update. I know I might not receive a reply to this, but you cannot really withhold yourself from asking when can we expect the next release (I would be happy with a tentative idea, I know concrete timelines migh be difficult to predict).

r_honey
2 Mar 2012, 11:35 AM
This issue seems to have come back with RC0 :(
Further if I do:

root.appendChild(nodes) to the root of a NestedList, the first item is displayed twice.

32335

r_honey
2 Mar 2012, 12:12 PM
The duplication seems to be happening at this place in NestedList:


getList: function(node) {
var me = this,
nodeStore = Ext.create('Ext.data.NodeStore', {
recursive: false,
node: node,
rootVisible: false,
model: me.getStore().getModel()
});

r_honey
21 Mar 2012, 9:32 AM
This seems to be present in Touch 2.0 Release version also, is this going to be fixed?

I can provide a url which demonstrates this issue if required.

r_honey
21 Mar 2012, 10:28 AM
As this thread has already been marked fixed, I have created a new thread with sample code demonstrating the issue here:
http://www.sencha.com/forum/showthread.php?189793-NoteInterface.appendChild-also-adds-the-nodes-to-the-parent-list&p=761549

Magg45
21 Jul 2013, 11:47 PM
I didn't any idea about this particular bug.. I also thought, it is shown in Touch 2.0

dperriero
27 Jan 2014, 6:03 PM
I'm still seeing this bug in Touch 2.2.1

This is how I'm implementing the appendChild.



me.currentParentNode.set('leaf', false);
me.currentParentNode.commit();

modifiedNode.set('id', objResp.data.id);
modifiedNode.set('version', objResp.data.version);
modifiedNode.set('leaf', true);
modifiedNode.commit();

me.currentParentNode.appendChild(modifiedNode);
me.getPremiseView().goToNode(me.currentParentNode);



The child is appended to the parent, but if you hit the back button on the nestedlist, the child remains as a sibling to the parent.

I've tried all of the overrides in the previous threads and they don't work, so I'm at wit's end on what to do at this point.

Any help would be great.

Thanks