Upon tree node removal the parent folder wrongly takes on file icon
I have a context menu that has a delete option, once the node is clicked for deletion it is deleted on the server and once a true response is accepted the folder/file is deleted from the tree. The problem is that when this happens the parent folder claims a leaf icon (file icon) rather than the folder icon it previously possessed. The cls, iconCls attributes are the same, and the leaf attribute of the parent is still undefined. Once node.remove() is called the parent node has the new icon.
I have tried as you will see below to issue a reload on the parent to try to flush this issue out, but it does not help. Only upon reloading the grandparent of the deleted node does the parent go back to the folder icon.
Many thanks for any assistance I can get!
function initiateDeleteNode(node){
Ext.MessageBox.confirm('Confirm Deletion', 'Do you want to delete: ' + node.attributes.text + '?', function(btn){
if (btn == 'yes') {
// Delete Node on server
url = 'http://url.com';
if(node.attributes.type == 'file'){
params = {
'nodeID': node.attributes.fileID,
'nodeType': node.attributes.type
};
} else if (node.attributes.type == 'folder'){
params = {
'nodeID': node.attributes.id,
'nodeType': node.attributes.type
};
}
var parentNode = node.parentNode;
Ext.Ajax.request({
url: url,
method: 'POST',
success: function(response, options){
// forces node to refresh
if (response.responseText == 'true') {
fileTreeLoader.load(parentNode);
node.expand(parentNode);
}
else {
Ext.MessageBox.alert('Delete Failed', 'You do not have permissions to delete this item');
}
},
params: params
});
}
});
}
Any news?
If you open up a folder in this example from extjs and then drag out all the child elements the same issue occurs where the parent element wrongly becomes a file leaf.
For example find the adapter directory, drag out the 5 or so files within it and it changes to a leaf/file
Any thoughts/help?
#If you have any other info about this subject , Please add it free.# |