In umbraco 4.7.1 how you do refresh / reload tree in action handler? I am using autofolders and have a date field which when updated will move the document to new date folder. I also have another action handler BeforePublish action which updates the createDate to newly set date. What I want todo is get the tree to refresh and open out to location of moved item. I have tried the following code
//Reload the node in the tree on the left and show a speech bubble the data was succesfully saved.
BasePage.Current.ClientTools
.SyncTree(path, true)
.ShowSpeechBubble(BasePage.speechBubbleIcon.save, "Saved", "The data has been saved succesfully");
//Reload the tree after sorting.
BasePage.Current.ClientTools.ReloadActionNode(false, true);
I had loads of problems with this when I was updating AutoFolders to work in 4.7. In the end, I had to reload the content page (nasty, nasty hack), as that forced the tree to reload in the correct position. None of the other client tools functions that I tried actually worked. I think due to the fact that the node had moved and wasn't in the tree in the same place any more. Here's the code I used:
If you do find a better way of doing this, let me know, and I'll update AutoFolders (going to release the 4.7 compatible version later on today hopefully)!
Refresh tree in action handler
In umbraco 4.7.1 how you do refresh / reload tree in action handler? I am using autofolders and have a date field which when updated will move the document to new date folder. I also have another action handler BeforePublish action which updates the createDate to newly set date. What I want todo is get the tree to refresh and open out to location of moved item. I have tried the following code
((BasePage)HttpContext.Current.CurrentHandler).ClientScript.RegisterClientScriptBlock(GetType(),
Guid.NewGuid().ToString(), "<script>parent.refreshNode(" + sender.Id + ");</script>");
I have seen this work in older versions of umbraco not sure if in 4.7.1 you have to do something different?
Regards
Ismail
Here are some options you can try:
Jeroen
I had loads of problems with this when I was updating AutoFolders to work in 4.7. In the end, I had to reload the content page (nasty, nasty hack), as that forced the tree to reload in the correct position. None of the other client tools functions that I tried actually worked. I think due to the fact that the node had moved and wasn't in the tree in the same place any more. Here's the code I used:
BasePage.Current.ClientTools.ChangeContentFrameUrl(string.Concat("editContent.aspx?id=", documentObject.Id));
If you do find a better way of doing this, let me know, and I'll update AutoFolders (going to release the 4.7 compatible version later on today hopefully)!
Jeroen,
Thanks for the suggestion. I get the speechbubble but tree does not refresh and open out to the item.
Regards
Ismail
Tim,
Awesome dude that worked a treat it may be dirty but sometimes needs must!
Regards
Ismail
is working on a reply...