Not sure how it would go with the dashboard, but when I do it via an actionhandler in V4 I use
library.UpdateDocumentCache(documentObject.Id);
library.RefreshContent();
[quote]Not sure how it would go with the dashboard, but when I do it via an actionhandler in V4 I use
library.UpdateDocumentCache(documentObject.Id);
library.RefreshContent();[/quote]
I'd not use library.UpdateDocumentCache() when creating the item because UpdateDocumentCache will publish the document as well... If you'd like to publish in a single operation, then leave it there.
Neither library.UpdateDocumentCache(documentObject.Id) nor library.RefreshContent() seems to reload the content tree - at least not when called from a dashboard control.
Perhaps there is some JavaScript function which can be called to trigger the Content Tree to reload.
So, reloading the frame containing the Content Tree using JavaScript?
If I do that in firefox just using Right click -> This frame -> Reload frame, the Content Tree reloads all right, but it does not expand down to the node I currently have open.
In fact it isn't a dashboard control I am using, but a datatype control from which I have placed some code to create a child item. What I want to do with this reload is to update the Content Tree so it knows that current item now contains children.
So, for a dashboard control your suggestion would actually do the trick, if it wouldn't be required to set focus on a specific item.
I am trying to do the same thing. I want to reload the content tree after I created a new node with a datatype. In the umbraco source code I found the following javascript:
[code]
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;
}
}
}
}
[/code]
Should this work and how can I call this javascript method from my code behind?
How to reload the content tree?
I have created a dashboard control which can create a content item. I would like to reload the content tree after creating this item.
How do I reload the content tree for a specific node while keeping the same item selected?
Or - what options are there to reload the content tree?
Kind regards
Dennis Milandt
Not sure how it would go with the dashboard, but when I do it via an actionhandler in V4 I use
library.UpdateDocumentCache(documentObject.Id);
library.RefreshContent();
Solves if for me.
Thank you very much - I will try that.
Hi,
[quote]Not sure how it would go with the dashboard, but when I do it via an actionhandler in V4 I use
library.UpdateDocumentCache(documentObject.Id);
library.RefreshContent();[/quote]
I'd not use library.UpdateDocumentCache() when creating the item because UpdateDocumentCache will publish the document as well... If you'd like to publish in a single operation, then leave it there.
Regards,
/Dirk
Neither library.UpdateDocumentCache(documentObject.Id) nor library.RefreshContent() seems to reload the content tree - at least not when called from a dashboard control.
Perhaps there is some JavaScript function which can be called to trigger the Content Tree to reload.
Hi Have not tested this, but try [code]parent.node.reload();[/code] in your Javascript function.
Cheers,
Richard
So, reloading the frame containing the Content Tree using JavaScript?
If I do that in firefox just using Right click -> This frame -> Reload frame, the Content Tree reloads all right, but it does not expand down to the node I currently have open.
In fact it isn't a dashboard control I am using, but a datatype control from which I have placed some code to create a child item. What I want to do with this reload is to update the Content Tree so it knows that current item now contains children.
So, for a dashboard control your suggestion would actually do the trick, if it wouldn't be required to set focus on a specific item.
I am trying to do the same thing. I want to reload the content tree after I created a new node with a datatype. In the umbraco source code I found the following javascript:
[code]
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;
}
}
}
}
[/code]
Should this work and how can I call this javascript method from my code behind?
is working on a reply...