View Full Version : tree management, editing problem after adding

3 Jul 2007, 7:49 AM

Well, after beginning with my first layout, i finally started real coding.
My first goal is to make a managed tree, with a toolbar to add / remove files and folders. The tree items are also supposed to be editables.

The "remove" button already works and the "label edition too" and so does the the "Add directory". The problem i have is that immediatly after being added, the Item is supposed to be focused to be named. The fact is that i can t get the added fields editable and i don t understand why.

If someone could gimme a clue... because i ve just no idea about what else to try :)
As i m begginning, any comments are welcomed :)




Layout = function(){
return {
init : function(){

/////// TOOLBAR ///////
var tb = new Ext.Toolbar('toolbar');
{text: 'Enregistrer',handler: saveTree},
{text: 'R

3 Jul 2007, 12:04 PM
The way I handle the naming of newly created nodes:

1) The user clicks "New Node".
2) A prompt appears asking: "Name for new node:".
3) The user types a name and clicks "Ok".
4) A node is created with the name specified.

Some of this is unique to my system, but you can get a direction from this...

addNodeConfirm: function(menu, e){
if(!vv.selectedNode || !vv.selectedTree || vv.selectedTree.isLibrary) {return;}
var newNodeType = menu.nodeType;

// If there is default text specified, use that. Otherwise prompt for input.
if(getNodeTypeConfig(newNodeType).text) {
addTreeNode(vv.selectedTree, newNodeType);
else {
handleCreate = function (btn, text, cBoxes){
if(btn == 'ok' && text) {
addTreeNode(vv.selectedTree, newNodeType, text);
msg: 'Name of new ' + getNodeTypeConfig(newNodeType).name + ':',
buttons: Ext.MessageBox.OKCANCEL,
fn: handleCreate,
validator: validators.childName