* @cfg {Boolean} allowDrop false if this node cannot be drop on
* @cfg {Boolean} disabled true to start the node disabled
* @cfg {String} icon The path to an icon for the node. The preferred way to do this
- * is to use the cls or iconCls attributes and add the icon via a CSS background image.
+ * is to use the cls or iconCls attributes and add the icon via a CSS background image.
* @cfg {String} cls A css class to be added to the node
* @cfg {String} iconCls A css class to be added to the nodes icon element for applying css background images
* @cfg {String} href URL of the link used for the node (defaults to #)
* @cfg {Boolean} singleClickExpand True for single click expand on this node
* @cfg {Function} uiProvider A UI <b>class</b> to use for this node (defaults to Roo.tree.TreeNodeUI)
* @cfg {Boolean} checked True to render a checked checkbox for this node, false to render an unchecked checkbox
- * @cfg {Array} children Array of Children to be added when created..
-
* (defaults to undefined with no checkbox rendered)
* @constructor
* @param {Object/String} attributes The attributes/config for the node or just a string with the text for the node
*/
-Roo.tree.TreeNode = function(attributes)
-{
+Roo.tree.TreeNode = function(attributes){
attributes = attributes || {};
if(typeof attributes == "string"){
attributes = {text: attributes};
* @type TreeNodeUI
*/
this.ui = new uiClass(this);
-
+
+ // finally support items[]
+ if (typeof(this.attributes.items) == 'undefined' || !this.attributes.items) {
+ return;
+ }
+
+
+ Roo.each(this.attributes.items, function(c) {
+ this.appendChild(Roo.factory(c,Roo.Tree));
+ }, this);
+ delete this.attributes.items;
+
};
// these methods are overridden to provide lazy rendering support
// private override
- appendChild : function(){
+ appendChild : function()
+ {
var node = Roo.tree.TreeNode.superclass.appendChild.apply(this, arguments);
if(node && this.childrenRendered){
node.render();