PDA

View Full Version : ExtJS 4.1: How to manually build a tree?



Felicitus
11 Jun 2012, 12:26 PM
Hi,

my app was running quite nice using ExtJS 4.0.x. However, the way how one can build a tree manually (in contrast to loading tree data from a server) seems to have been changed. This is how I did it previously:



buildCategoryTree: function(root, data, expandedNodes) {
var nodeData = {
id: data.id,
name: data.name,
description: data.description,
text: data.label,
tooltip: data.description
};
// Hack to prevent our virtual root node from being dragged if (data.id == 1) { nodeData.allowDrag = false; }
var node = root.appendChild(Ext.create("MyModel", nodeData));
for (var i = 0; i < data.children.length; i++) {
this.buildCategoryTree(node, data.children[i], expandedNodes);
}
}?


However, with ExtJS 4.1.0, I get "updateInfo" is not defined. I tried various things, like decorating the new node manually and passing plain non-model data (nodeData) to appendChild, but none of these methods did work.

Does anybody have an example on how this works in ExtJS 4.1.0?

pradeep122
25 Sep 2012, 11:35 PM
I have recently migarted to 4.1 from 4.0.7 and my dynamic tree gereration code breaks.

I use a similar approach to Felicitus and get a simlar error 'updateInfo is not defined' . Did anyone manage to solve this?

Thankx ion advance

-- pradeep