Copied to clipboard

Flag this post as spam?

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


  • Ayo Adesina 445 posts 1059 karma points
    Sep 14, 2017 @ 13:11
    Ayo Adesina
    0

    Custom Menu Items & Trees, How does navigation work?

    I have a custom section, with a custom tree.

    I'm having a bit of trouble understanding how you set the correct behavior when:

    1. You click a node in your tree to edit it.
    2. You click a menu item on a node like "Create"

    In my solution I'm using the same view to edit and create a record.

    In my tree this is how a node is generated.

    var routeToView = "rewards/rewardsTree/editcampaign/campaign-" + campaign.Id.ToString();
    
    var campaignNode = CreateTreeNode("campaign-" + campaign.Id.ToString(), id.Split('-')[1], queryStrings, campaign.CampaignName, "icon-folder color-yellow", true, routeToView);
    

    This is producing the route I want: (the name of my html file is editcampaign.html) and it is also passing "campaign-6"

    /umbraco#/rewards/rewardsTree/editcampaign/campaign-6
    

    When a user clicks the create 'menu Item' on the node - I want to send them to the same URL but just with a diffrent Id for example:

    umbraco#/rewards/rewardsTree/editcampaign/brand-1
    

    and I don't want it to pop up out of the side

    This is what I have tried so far:

    //This finds the view, but it comes up in a dialog also how do I pass the Id (brand-1)
         MenuItem mi = new MenuItem("editcampaign", "Create Campaign");
                        menuItemCollection.Items.Add(mi);
    
    //Also Tried this finds puts a whole another umbraco UI inside a dialog
    
        mi.LaunchDialogView("#rewards/rewardsTree/editcampaign/brand-1", "TITLE GOES HERE");
    

    Can anyone point me to the fullest documentation for Menu's trees and navigation around the back office in general?

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Sep 14, 2017 @ 14:10
    David Brendel
    100

    Hi Ayo,

    have a look at "NavigateToRoute()". It's a methode of menu items.

    Regards David

  • Ayo Adesina 445 posts 1059 karma points
    Sep 14, 2017 @ 14:15
    Ayo Adesina
    0

    Thanks, this worked for me

    mi.NavigateToRoute("/appName/treeAlias/htmlviewWithoutHTML/id");
    
Please Sign in or register to post replies

Write your reply to:

Draft