PDA

View Full Version : [CLOSED] Keep nodes expanded after refresh



profitsistemas
Feb 22, 2013, 12:25 AM

Baidaly
Feb 22, 2013, 1:51 AM
Hello!

Try to use this function:



var refreshTree = function (tree) {
var expNodes = [];
tree.getRootNode().cascadeBy(function (node) {
if (node.isExpanded()) {
expNodes.push(node.data.id);
}
});

App.direct.RefreshMenu({
success: function (result) {
var nodes = eval(result);
if (nodes.length > 0) {
tree.setRootNode(nodes[0]);
for (var i = 0; i < expNodes.length; i++) {
var node = tree.store.getNodeById(expNodes[i]);
if (node) {
node.expand(false, false);
}
}
}
else {
tree.getRootNode().removeAll();
}
}
});
};

profitsistemas
Feb 22, 2013, 11:47 AM
Thanks @Baidaly ! It worked perfectly.