* @constructor
* @param {Object} config (used to be the tree panel.)
* @param {Object} oldconfig DEPRECIATED Either a prebuilt {@link Roo.form.Field} instance or a Field config object
+ *
* @cfg {Roo.tree.TreePanel} tree The tree to bind to.
-
+ * @cfg {Roo.form.TextField|Object} field The field configuration
+ *
*
*/
Roo.tree.TreeEditor = function(config, oldconfig) { // was -- (tree, config){
var tree = config;
- if (oldconfig) {
- config = oldconfig;
+ var field;
+ if (oldconfig) { // old style..
+ field = oldconfig.events ? oldconfig : new Roo.form.TextField(oldconfig);
} else {
+ // new style..
tree = config.tree;
+ config.field = config.field || {};
+ config.field.xtype = 'TextField';
+ field = Roo.factory(config.field, Roo.form);
}
config = config || {};
- var field = config.events ? config : new Roo.form.TextField(config);
+
this.addEvents({
/**
"beforenodeedit" : true
});
-
- Roo.tree.TreeEditor.superclass.constructor.call(this, field);
+ //Roo.log(config);
+ Roo.tree.TreeEditor.superclass.constructor.call(this, field, config);
this.tree = tree;
this.maxWidth,
(td.clientWidth > 20 ? td.clientWidth : td.offsetWidth) - Math.max(0, nd.offsetLeft-td.scrollLeft) - /*cushion*/5);
this.setSize(w, '');
+
+ return this.fireEvent('beforenodeedit', this, this.editNode);
+
},
// private
this.triggerEdit(node);
return false;
}
+ return true;
},
// private