PDA

View Full Version : About Ext.data.NodeInterface eachChild() method and removed nodes



mx_starter
26 Mar 2014, 5:00 AM
Hello, i need an advise, please take a look at this fiddle:

https://fiddle.sencha.com/fiddle/4hk

4hk

In short it does the following:

1. If a node is checked:
1.1. If the node has children, all of them are set to be cheked also recursively and if not have childs itself, they are removed

My purpose is:
When i click the chekbox of the parentnode (with text "homework"), the other two nodes to be checked and removed.

However, it happens on the first child only and after that console show an error.

I suppose this is due to the way eachChild() method works.

Any ideas how to overcome this?

mx_starter
27 Mar 2014, 4:40 AM
Well, althought not ellegant, the row below solved my problem:


if (subnode == undefined) { subnode = node.firstChild; }
just before


subnode.set('checked', checked ? true : false);