Copied to clipboard

Flag this post as spam?

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


  • Kevon K. Hayes 255 posts 281 karma points
    Nov 23, 2010 @ 22:45
    Kevon K. Hayes
    1

    How to reload the Content Tree and Reload Right IFRAME

    UMB 4.5.2

    I programatically made changes to a couple of custom properties, published them, and now I'd like to refresh the backend UI to reflect those changes.

    So how would you...

    1) refresh the Content Tree in the Content Section?
    2) reload the Right Iframe section to the node/doc of choice?

  • Rob Watkins 369 posts 701 karma points
    Nov 30, 2010 @ 15:36
    Rob Watkins
    0

    Hi Kevon, I am looking for a way to refresh the content tree myself, after deleting a node, did you manage to solve that one?

    For reloading the right frame, from server side code, what I have done in a UserControl custom datatype is simply:

    Response.Redirect("editContent.aspx?id=" + sMyNodeID)

    Probably a more API friendly way of doing things, which also works from ApplicationBase handlery things (I got this from the DateFolders package by kipusoep) is:

    umbraco.BasePages.BasePage.Current.ClientTools
        .ChangeContentFrameUrl(string.Concat("editContent.aspx?id=", iMyNodeID));

    That will also sync the content tree to that node, although I don't know off the top of my head if it refreshes it as well.

  • Rob Watkins 369 posts 701 karma points
    Nov 30, 2010 @ 16:02
    Rob Watkins
    0

    ...no, it doesn't refresh; my deleted node still appears in the tree after the redirect / contentframeurl change.

    And something to bear in mind is that the client tools redirect is just that; a client redirect, so if you do it from a usercontrol it will load the current node then redirect from the client. This is pretty ugly so I am sticking with the Response.Redirect for my purposes.

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Nov 30, 2010 @ 16:10
    Hendy Racher
    0

    Hi Rob

    Is the following snippet any use ?

     

    UmbClientMgr.mainTree().refreshTree('content');

    That should refresh the whole tree - see this post.

    HTH,

    Hendy

  • Rob Watkins 369 posts 701 karma points
    Nov 30, 2010 @ 16:51
    Rob Watkins
    0

    Hi Hendy, I think I found the server side utility to link to that as you were posting that actually :o)

    I am currently doing this after my node change:

    umbraco.BasePages.BasePage.Current.ClientTools.RefreshTree();
    umbraco.BasePages.BasePage.Current.ClientTools
        .ChangeContentFrameUrl(String.Concat("editContent.aspx?id=", DiaryRootID));

    The RefreshTree() reloads the tree (it has an overload taking a string treeType so I suspect it generates the UmbClientMgr script exactly as in your solution).

    Then the ChangeContentFrameUrl() loads the node on the right and syncs the tree to it.

    It's not completely ideal, as in my solution, it means you get the current right hand frame loading due to the node deletion postback, then instantly loading again as the client scripts fire; however, it is the only way I have found so far of syncing the tree - if you know of a way of syncing the tree to a specific node, or in fact just the current right hand node without reloading that frame, that'd be amazing :o)

    I mean, it must be possible, because something is doing it when you do a Response.Redirect from within the right hand frame.

  • Rob Watkins 369 posts 701 karma points
    Nov 30, 2010 @ 17:20
    Rob Watkins
    0

    Just as an addendum, I made the double load a bit less ugly by setting Visible to false in my usercontrol delete item handler; this means that only a blank page is displayed before the client location change, which is much less distracting and "flickery".

  • Kevon K. Hayes 255 posts 281 karma points
    Nov 30, 2010 @ 22:28
    Kevon K. Hayes
    0

    @Rob - Sorry for the late response...  No, I didn't solve this yet. However, I do know when we click on the Save and Publish icon it has the desired effect we're all looking for...  kinda drives me crazy.

Please Sign in or register to post replies

Write your reply to:

Draft