-
28 Oct 2011 8:17 AM #1
Answered: Ext.data.NodeInterface not accepting config options
Answered: Ext.data.NodeInterface not accepting config options
I am adding in nodes to a tree. The way I am doing this is:
But once I get treeNode, text is blank, and leaf is false. Any ideas of why that might not take? It renders that way as well (as a folder and with no text).Code:var nodeConfig = { leaf:true, text:"some text, cls:"", iconCls:"" }; var treeNode = new Ext.data.NodeInterface(nodeConfig);
Note: I used firebug to tell me what the text and leaf are after the definition. I then used an appendChild statement to the root node to add it to the tree, which is where it rendered incorrectly as well.
-
Best Answer Posted by skirtle
You can't create an instance like that. NodeInterface is a decorator.
Just pass your node config to the appendChild() method, it'll do all the work for you. If you want to create an instance yourself then it'll need to be an instance of the model that backs the store, not NodeInterface.
If you want to see the full gory details of how this all works then take a look at the code for appendChild().
-
28 Oct 2011 9:56 AM #2
You can't create an instance like that. NodeInterface is a decorator.
Just pass your node config to the appendChild() method, it'll do all the work for you. If you want to create an instance yourself then it'll need to be an instance of the model that backs the store, not NodeInterface.
If you want to see the full gory details of how this all works then take a look at the code for appendChild().
-
28 Oct 2011 11:13 AM #3
Thanks. That does answer the question. The API doc was written saying to pass it an instance of an Ext.data.NodeInterface. Passing just the config did fix the issue. Thanks very much.
The api doc was here.
https://72.1.109.240:49324/esp/js/ext/docs/#!/api/Ext.data.NodeInterface


Reply With Quote