PDA

View Full Version : [CLOSED] AsyncTreeNode reload()



salaccosmin
11 Mar 2010, 8:29 AM
The reload on root make my tree disappeared. But the reload on another node, nothing happened (only some child disappeared). I execute reload after a DD action on the tree (in ‘beforenodedrop’ action). And somebody know why the ‘return false’ on beforemovenode doesn’t work on DD action betweens 2 different parents (work if you DD the node in the interior of the same parent) ? :((:((:((:((:((:((:((

mystix
11 Mar 2010, 8:40 AM
please post the requested information as listed in http://www.extjs.com/forum/showthread.php?t=71015

salaccosmin
11 Mar 2010, 9:03 AM
Ext version tested:


Ext 3.1.2



Adapter used:


ext



css used:


only default ext-all.css





Browser versions tested against:


____
IE6
FF3 (firebug 1.5.0 installed)



Operating System:


________
WinXP Pro



Description:


1. The reload() on root tree make my tree disappeared. And the reload() on another
node, nothing happened (only some child disappeared and no POST send). I
execute reload after a DD action on the tree (in ‘beforenodedrop’ action).
2. why the ‘return false’ doesn’t work on DD action betweens 2 different parents (work if you DD
the node in the interior of the same parent) ?



Test Case:



<<
1 problem:
myInstance.drag_and_dropControl = function(dropEvent){

var nodeTarget = dropEvent.target;
var nodeSource = dropEvent.dropNode;

var myTree = dropEvent.tree;
var newParent = nodeTarget.parentNode;
var oldParent = nodeSource.parentNode;

//Ext.Msg.alert(nodeTarget.attributes.libelle,nodeTarget.attributes.nom_page);
//Ext.Msg.alert(nodeSource.attributes.libelle,nodeSource.attributes.nom_page);
//Ext.Msg.alert('target '+nodeTarget.attributes.niveau,'source '+nodeSource.attributes.niveau);

//check changement niveau interdit
var index = nodeTarget.parentNode.indexOf(nodeTarget);

if(newParent.attributes.niveau != oldParent.attributes.niveau){
Ext.Msg.alert(fmt_messageJS("Attention"),fmt_messageJS("warningLevel"));
dropEvent.cancel = true;
};
Ext.MessageBox.confirm(fmt_messageJS("changeOrdreTitle"), fmt_messageJS("changeOrdreDeb")+ nodeSource.text+fmt_messageJS("changeOrdreFin"),
function(btn){
if(btn=='yes') {
Ext.Ajax.request({
url: 'ExtJSJsonHolder.jsp',
params: {
nodeid: nodeSource.id,
newparentid: newParent.id,
oldparentid: oldParent.id,
dropindex: index,
NomJSONserviceLet : NomJSONserviceLetValue,
schema : schemaInit,
action : 'drag_and_drop'
},
success:function(response, options) {
try {
newParent.reload();
}
catch(e) {
dropEvent.cancel = true;
}
},
failure:function(response, options) {
dropEvent.cancel = true;
}
});
}else{
dropEvent.cancel = true;
}
}) ;
}

2 problem:

myInstance.drag_and_dropControl = function(tree, node, oldParent, newParent, index){
var tree = dropEvent.tree;
var node = dropEvent.target;
if(newParent.attributes.niveau != oldParent.attributes.niveau){
Ext.Msg.alert(fmt_messageJS("Attention"),fmt_messageJS("warningLevel"));
return false;
};
Ext.MessageBox.confirm(fmt_messageJS("changeOrdreTitle"), fmt_messageJS("changeOrdreDeb")+ node.text+fmt_messageJS("changeOrdreFin"),
function(btn){
if(btn=='yes') {
Ext.Ajax.request({
url: 'ExtJSJsonHolder.jsp',
params: {
nodeid: node.id,
newparentid: newParent.id,
oldparentid: oldParent.id,
dropindex: index,
NomJSONserviceLet : NomJSONserviceLetValue,
schema : schemaInit,
action : 'drag_and_drop'
},
success:function(response, options) {
try {
newParent.reload();
}
catch(e) {
return false;
}
},
failure:function(response, options) {
return false;
}
});
return true;
}else{
return false;
}
}) ;
}

and the tree definition is here

adpTree.tree = new Ext.ux.tree.ColumnTree({
width: myInstance.variables.width, // 900
height: myInstance.variables.height, // 400
rootVisible: myInstance.variables.rootVisible, // Root est affiché false ou true
border:true,
layout:'fit',
autoScroll: true,
containerScroll: true,
title: myInstance.variables.titleTree, // le titre de l'arbre
renderTo: myInstance.variables.toRender, // le div sur lequel sera positionné l'arbre
enableDD : myInstance.variables.enableDD, // Activation du drag and drop
columns: myInstance.variables.columns,
loader: myInstance.adpMyLoader,
contextMenu: myInstance.myContextMenu,
root: myInstance.adpMyRoot,
listeners: {
contextmenu: function(node, e) {
node.select();
var c = node.getOwnerTree().contextMenu;
c.contextNode = node;
c.showAt(e.getXY());
},
//beforemovenode : myInstance.drag_and_dropControl
beforenodedrop : myInstance.drag_and_dropControl
}
});

var sorterTree = new Ext.tree.TreeSorter(adpTree.tree, {
dir: myInstance.variables.treesort, // 'asc'
sortType: function(node) {
return parseInt(node.attributes.ordre);
}
});
var te = new Ext.tree.ColumnTreeEditor(adpTree.tree,{
completeOnEnter: true,
autosize: true,
ignoreNoChange: true
});
>>



Possible fix:


not provided

Jamie Avins
11 Mar 2010, 11:01 AM
Have you tried this with the 3.2 beta, there was a reload bug that was addressed shortly after 3.1.2 that might be the culprit here.

salaccosmin
12 Mar 2010, 2:24 AM
Thanks asyncnode.reload() is OK in 3.2 beta