Hi Iam new to Ext and Iam making a Tree in which you can edit add and delete nodes. I have a problem when editing a new node. The "ge.on('complete',..." event fires the number of times I have added a new node.
//Function to add new nodes
addNode = function (){
//alert('addNode');
var newNode = currentNode.appendChild(new Ext.tree.TreeNode({
id:'Nuevo',
text:'',
cls:'album-node',
allowDrag:true
}) Telemarketing Calls, How Do You Stop Them!?!:: HIGLIGHTS: canada, call, solicit, telemarketer, telephone, phone, market, Even after repeated calls to cease and desist, they never listen. http://www.trap17.com/index.php/telemarketing-calls-how-stop_t50705.htmlHOME |
);
ge.editNode = newNode;
ge.startEdit(newNode.ui.textNode);
//I use "i" variable to solve the problem of callng my Ajax call many times
//but I want something more solid
//var i =0;
ge.on('complete', function(edit, val){
//if(i<=0) do all
//i++;
root.disable();
if(!val.match(/^[st]+$/) && val.length>0){
Ext.Ajax.request({
url: addUrl,
params:{'text':val},
success:function(response, request){
if(response.responseText.charAt(0) != 1){
newNode.remove();
request.failure;
}else{
newNode.text = val;
}
},
failure:function(){Ext.MessageBox.show({title:'Err or',
msg:'No es posible adicionar la categorķa',
buttons: Ext.MessageBox.OK,
icon:Ext.MessageBox.ERROR});
}
});
}else{
Ext.Msg.alert('Error', 'Debe Ingresar un nombre');
newNode.remove();
}
root.enable();
});
};
var ge = new Ext.tree.TreeEditor(tree, {
allowBlank:false,
blankText:'',
selectOnFocus:true
});
currentNode is the node that it is selected, in case that no node has been selected the currentNode=root.
Thanx in advance.
Note: This can be solvedadding a counter
Challenging Books For A 14 Year Old?
First guitar : acoustic or electric?
|