I just had a specific request from a customer, they were working on hundreds of new nodes and creating child nodes on most of them. Except, to actually SEE the child nodes, they'd have to reload the parent tree, which in turn closes all of the opened nodes, which made the customer loose their sense of progress and required a lot of extra clicking for them.
So to fix this, I had a look at what the "Reload nodes" function actually does and I came upon this code in umbraco/js/umbracoDefault.js :
function refreshNode() {
if (nodeKey != '') {
if (tree.webFXTreeHandler.all[nodeKey]) {
tree.webFXTreeHandler.all[nodeKey].src =
tree.webFXTreeHandler.all[nodeKey].src + '&rnd=' + Math.random() * 10;
if (tree.webFXTreeHandler.all[nodeKey].parentNode) {
// Hvis punktet er lukket, skal det åbnes
if (tree.webFXTreeHandler.all[nodeKey].childNodes.length > 0) {
if (!tree.webFXTreeHandler.all[nodeKey].open)
tree.webFXTreeHandler.all[nodeKey].expand();
tree.webFXTreeHandler.all[nodeKey].reload();
treeEdited = true;
}
} else {
tree.document.location.href = tree.document.location.href;
}
}
}
}
Now, Google Translate says that "Hvis punktet er lukket, skal det åbnes" means: "If the item is closed, it opens". Makes sense... ;-)
I decided to just try and remove all the checks, they don't seem necessary. I don't want to check if the childnodes is larger than 0, I actually want to find that out during the reload! So I ended up with this:
function refreshNode() {
if (nodeKey != '') {
if (tree.webFXTreeHandler.all[nodeKey]) {
tree.webFXTreeHandler.all[nodeKey].src =
tree.webFXTreeHandler.all[nodeKey].src + '&rnd=' + Math.random() * 10;
tree.webFXTreeHandler.all[nodeKey].expand();
tree.webFXTreeHandler.all[nodeKey].reload();
treeEdited = true;
}
}
}
Which leaves me with one little bug, if indeed there are no childnodes, a black arrow pointing downwards will keep hanging in front of the content item. I don't mind though, I've told the content editor to wait a second to see if a white arrow pointing to the node.
Am I creating horrible other bugs now? It seems to work fine.
Because they are entering data right now and can't wait for months.
Besides, I am not going to upgrade this project right away (most probably not going to upgrade at all, it's stable and tested and I don't need to introduce the upgrading headaches).
Fix for "reload nodes"?
I just had a specific request from a customer, they were working on hundreds of new nodes and creating child nodes on most of them. Except, to actually SEE the child nodes, they'd have to reload the parent tree, which in turn closes all of the opened nodes, which made the customer loose their sense of progress and required a lot of extra clicking for them.
So to fix this, I had a look at what the "Reload nodes" function actually does and I came upon this code in umbraco/js/umbracoDefault.js :
Now, Google Translate says that "Hvis punktet er lukket, skal det åbnes" means: "If the item is closed, it opens". Makes sense... ;-)
I decided to just try and remove all the checks, they don't seem necessary. I don't want to check if the childnodes is larger than 0, I actually want to find that out during the reload! So I ended up with this:
function refreshNode() { if (nodeKey != '') { if (tree.webFXTreeHandler.all[nodeKey]) { tree.webFXTreeHandler.all[nodeKey].src = tree.webFXTreeHandler.all[nodeKey].src + '&rnd=' + Math.random() * 10; tree.webFXTreeHandler.all[nodeKey].expand(); tree.webFXTreeHandler.all[nodeKey].reload(); treeEdited = true; } } }
Which leaves me with one little bug, if indeed there are no childnodes, a black arrow pointing downwards will keep hanging in front of the content item. I don't mind though, I've told the content editor to wait a second to see if a white arrow pointing to the node.
Am I creating horrible other bugs now? It seems to work fine.
Maybe I'm missing the point but why spend time on an issue which is already fixed in the next release?
Because they are entering data right now and can't wait for months.
Besides, I am not going to upgrade this project right away (most probably not going to upgrade at all, it's stable and tested and I don't need to introduce the upgrading headaches).
is working on a reply...