Copied to clipboard

Flag this post as spam?

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


  • Daniel Bardi 924 posts 2556 karma points
    Jul 02, 2011 @ 05:55
    Daniel Bardi
    0

    Need nodeType of action node on client side

    I know I can get nodeId with UmbClientMgr.mainTree().actionNode().nodeId;

    How do I get the nodeType?

    Tried UmbClientMgr.mainTree().actionNode().nodeType; but get error saying nodeType is not valid property (paraphrased).

    Any alternatives would be appreciated.

    Thanks!

  • Daniel Bardi 924 posts 2556 karma points
    Jul 02, 2011 @ 12:20
    Daniel Bardi
    0

    I can get the nodeId from the query string, but I won't know what tree it's associated with.

    Was hoping to use this:

    var nodeType = UmbClientMgr.mainTree().getActionNode().nodeType;

    .. but it's only valid if i am calling an action on a node (i.e. context menu).

    I actually  need the nodeType of the currently selected node of any tree. (i.e. when node is clicked)

  • Morten Christensen 596 posts 2770 karma points admin hq c-trib
    Jul 02, 2011 @ 14:03
    Morten Christensen
    0

    Hi Daniel,

    This might be a long shot since you are asking for clientside funtionality, but when you have the nodeId you can easily lookup the ContentType before doing anything else with it - this is done like:

    Content c = new Content(1046, false);
    ContentType type = c.ContentType;

    Constructor taking an integer or guid and then true/false for setup.

    The following classes derive from Content:
    ContentItem
    Document
    Media
    Member

    - Morten

  • Morten Christensen 596 posts 2770 karma points admin hq c-trib
    Jul 02, 2011 @ 14:14
    Morten Christensen
    0

    Or you could load it as a CMSNode object, which is the base for almost everything in Umbraco and then use the Guid from the nodeObjectType to load the ContentType like this:

    CMSNode node = new CMSNode(1046);
    Guid cId = nodeObjectType;
    ContentType type = new ContentType(cId, false);

    - Morten

  • Daniel Bardi 924 posts 2556 karma points
    Jul 03, 2011 @ 06:18
    Daniel Bardi
    0

    That would work if I was only worried about Content and Media nodes.. I need it to work for all nodes.. including ones in Settings, Developer, User and Member.

  • Daniel Bardi 924 posts 2556 karma points
    Jul 03, 2011 @ 09:41
    Daniel Bardi
    0

    I ended up doing this:

    var currentNodeType;

    $('li.loaded a').live('mouseover', function () {

        currentNodeType = $(this).parent().attr('umb:type');

    });

     

    It's not perfect, but it gives me the nodeType that the mouse is over just before the click.

    I can then pass the value to my function that calls to the server..

  • 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