Copied to clipboard

Flag this post as spam?

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


  • pnr 131 posts 226 karma points
    Nov 18, 2009 @ 11:18
    pnr
    0

    How to "reload nodes" after saving node

    How is it possible to reload the nodes in the tree after a node is saved? I know that it should bed possible if i use a event, so i looked at the event AfterSave, but i can't see how to reload the nodes from there.

    Is there anyone that can help?

    Thanks in advance!

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 18, 2009 @ 11:40
    Chris Houston
    1

    Hi,

    I think this is something that will be fixed in the next version of Umbraco ( v 4.1 ) as the tree has been completely replaced, as I believe it is soon to be released you might want to wait for this.

    Best regards,

    Chris

  • Delete me 45 posts 66 karma points
    May 17, 2010 @ 22:58
    Delete me
    0

    Hi there

    After struggling a lot with this, I found this way to reload a node from C#:

    ((BasePage)doc.HttpContext.CurrentHandler).ClientScript.RegisterClientScriptBlock(GetType(),
     Guid.NewGuid().ToString(), "<script>parent.refreshNode("+doc.Id+");</script>");

    Cheers,

    Mathias

  • Pat O'Callaghan 34 posts 56 karma points
    Jun 18, 2010 @ 01:06
    Pat O'Callaghan
    0

    Hi Mathias,

    could you tell me where this code should be added?

    In the Document_AfterSave Event?

    Thanks,

    Pat

  • Delete me 45 posts 66 karma points
    Jun 28, 2010 @ 09:11
    Delete me
    0

    Hi Pat,

    Yes, I used it in an AfterSave Event, but it works very unstable. A workaround is to hardcode the nodeKey and use this code:

    ((BasePage)doc.HttpContext.CurrentHandler).ClientScript.RegisterClientScriptBlock(GetType(), Guid.NewGuid().ToString(), 
    "<script>parent.tree.webFXTreeHandler.all['webfx-tree-object-XX'].reload();</script>");

    where XX is the nodeKey of the object you want to reload.

    Let me know if you make any improvements.

    Thanks,
    Mathias

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Jun 29, 2010 @ 05:19
    Aaron Powell
    0

    As Chris mentioned this problem had been fixed, and it is fixed in the recent 4.5 release.

    I recommend upgrading to that for a multitude of reasons, not just the improved tree.

    The reason for the bug was an inherit problem in xtree which use to power Umbraco. If there wasn't a child node before you created your new node then it would not refresh properly as it internally believed there to be no children, even once you created one.

    jsTree which powers Umbraco now does not have this problem and it just damn sexy!

  • Pat O'Callaghan 34 posts 56 karma points
    Jul 08, 2010 @ 10:55
    Pat O'Callaghan
    0

    Thanks guys I've been away from the forum. 

    At the time I didn't get it to work properly and didn't want to spend too much time on it, so I just left it as a caveat that the user has to be aware of i.e. they have to reload to view the node after saving it...

    I've been playing about with v4.5 and am liking what I've seen so far...

Please Sign in or register to post replies

Write your reply to:

Draft