Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Dec 16, 2011 @ 11:29
    Ismail Mayat
    0

    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

     

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Dec 16, 2011 @ 11:39
    Jeroen Breuer
    1

    Here are some options you can try:

    //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);

    Jeroen

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Dec 16, 2011 @ 12:01
    Tim
    1

    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)!

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Dec 16, 2011 @ 12:09
    Ismail Mayat
    0

    Jeroen,

    Thanks for the suggestion. I get the speechbubble but tree does not refresh and open out to the item.

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Dec 16, 2011 @ 12:18
    Ismail Mayat
    0

    Tim,

    Awesome dude that worked a treat it may be dirty but sometimes needs must!

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft