I have codeblock - hooked up on the event "ContentService.Saved". In this code I delete all childnodes of the saved node.
My problem is that this change to the content-tree is not reflected in the backoffice content-tree, forcing the user to do a manual 'Reload notes'.
I have tried several methods without any luck - see below for examples
Umbraco.Web.UI.Pages.BasePage bp = new BasePage();
bp.ClientTools.ChildNodeCreated();
bp.ClientTools.SyncTree(node.Path, true);
bp.ClientTools.ClearClientTreeCache();
That is currently not possible out the box, as the tree is rendered when requested, it doesnt keep track of what is going on the server in the meantime, for that you would need
to send push notifications to the browser, which umbraco currently doesnt do.
If its something you really need, I would recommend you look into the library "signalR" which can subscribe to your events on the serverside, then push messages to the browser where you could then handle these messages, making the tree refresh, but its a bit of work, and not somethign that is supported out of the box
I have worked with SignalR - it is quite fun to play with.
I would have been really nice to be able force a reload of the tree - at this would enable us to implement a kind of workflow-engine: If you do this to a node -> move it to another folder etc.
If the user needs to rightclick&reload it wont have the same effect.
Refresh content-tree in backoffice using api
Hi,
I have codeblock - hooked up on the event "ContentService.Saved". In this code I delete all childnodes of the saved node.
My problem is that this change to the content-tree is not reflected in the backoffice content-tree, forcing the user to do a manual 'Reload notes'.
I have tried several methods without any luck - see below for examples
Anybody with help or suggestions ?
Kind regards Morten
Hi Morten
That is currently not possible out the box, as the tree is rendered when requested, it doesnt keep track of what is going on the server in the meantime, for that you would need to send push notifications to the browser, which umbraco currently doesnt do.
If its something you really need, I would recommend you look into the library "signalR" which can subscribe to your events on the serverside, then push messages to the browser where you could then handle these messages, making the tree refresh, but its a bit of work, and not somethign that is supported out of the box
/Per
Hi Per,
Thnx for looking in to this.
I have worked with SignalR - it is quite fun to play with.
I would have been really nice to be able force a reload of the tree - at this would enable us to implement a kind of workflow-engine: If you do this to a node -> move it to another folder etc.
If the user needs to rightclick&reload it wont have the same effect.
keep up the good work :-)
Kind regards Morten
hi
Is it still the case that the content tree can't be reloaded from the server - in the Save event for example?
Dallas
is working on a reply...