I started with the following code:
Code:
refreshUIAfterDeletion: function() {
var treeSel = this.getTreeNodeSelection(),
me = this;
if (treeSel !== null) {
this.getGridCmp().getStore().reload();
if (treeSel.isExpanded() || treeSel.hasChildNodes()) {
treeSel.collapse(
false,
function() {
treeSel.removeAll(false, true);
treeSel.set('loaded', false); // mark as unloaded, ensure plus sign shown
},
me);
}
}
}
},
This all works fine.
But I needed that code to collapse and remove the children in a separate function, so I changed it to be:
Code:
collapseTreeNodeRemoveChildren: function(node) {
var me = this;
node.collapse(
false,
function() {
node.removeAll(false, true);
node.set('loaded', false); // mark as unloaded, ensure plus sign shown
},
me
);
},
refreshUIAfterDeletion: function() {
var treeSel = this.getTreeNodeSelection(),
me = this;
if (treeSel !== null) {
this.getGridCmp().getStore().reload();
if (treeSel.isExpanded() || treeSel.hasChildNodes()) {
this.collapseTreeNodeRemoveChildren(treeSel);
}
}
}
},
The tree gets updated fine, but now the grid refresh doesn't work. That seems really weird to me. Can anyone explain this, and even better, suggest a solution?
BTW, in order to not have the removeAll() call to not POST to the server (once for each child), I had to change removeAll(true) to be removeAll(false).
This means the nodes aren't being destroyed. Is there any downside to this? Is this a memory leak? Is there another/better way to avoid the POSTs to the server?
Thank you,
Brian