Copied to clipboard

Flag this post as spam?

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


  • Stephen 767 posts 2268 karma points c-trib
    Feb 14, 2012 @ 17:47
    Stephen
    0

    Umbraco Tree javascript API

    OK, this is driving me mad.

    I want to programmatically do to the tree what happens when I pick "reload" in the context menu.

    I have tried to use the reloadActionNode() method from the API and it triggers two calls to the data service, whereas the context menu only triggers one, and is much faster. I am tracing through the javascript code, but can anyone tell me: how do I trigger the reload?

    In addition I want the node to be selected again, so that whatever happens when a node is selected, happens. reloadActionNode() does not trigger the select event... Again, I have tried to trace through the javascript code, but...

    Can anyone help?

  • Stephen 767 posts 2268 karma points c-trib
    Feb 14, 2012 @ 18:01
    Stephen
    0

    At the moment I'm with this:

    var tree = $('.umbTree');
    var api = tree.UmbracoTreeAPI();
    var node = tree.find('.clicked').parent();
    api._loadChildNodes(node, null);
    api.selectNode(node, false, true);

    Anyone has a better idea?

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Feb 14, 2012 @ 18:26
    Tom Fulton
    0

    Hi,

    You can try using the SyncTree method - see this thread for both C# and Javascript examples.

    -Tom

  • Stephen 767 posts 2268 karma points c-trib
    Feb 14, 2012 @ 19:02
    Stephen
    0

    Thanks Tom. There seem to be many ways to do one thing :-)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies