Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've created a custom section with custome tree by following the documentation. All is fine and looking good, but what I'd like to know is how do I add a Action Menu to the top most (Tree Title) node? For example, on the Content section, hovering on the 'Content' title you will get the elipses that allows you to create new documents.
I'd like to replicate this functionality on my top level/title node to allow me to create new root nodes...
My guess is that there must be something in the 'CreateRootNode() method to do this? Any pointers?
You are looking for the GetMenuForNode() method! You can find examples here.
I have done something like this:
protected override MenuItemCollection GetMenuForNode(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))] FormDataCollection queryStrings)
var menu = new MenuItemCollection();
if (id == Root.ToInvariantString())
Hope this gets you on the right track! :)
I already have an implementation of that method as follows:
protected override ActionResult<MenuItemCollection> GetMenuForNode(string id, FormCollection queryStrings)
// create a Menu Item Collection to return so people can interact with the nodes in your tree
var menu = _menuItemCollectionFactory.Create();
if (id == Constants.System.Root.ToInvariantString())
// root actions, perhaps users can create new items in this tree, or perhaps it's not a content tree, it might be a read only tree, or each node item might represent something entirely different...
// add your menu item actions or custom ActionMenuItems
// add refresh menu item (note no dialog)
menu.Items.Add(new RefreshNode(LocalizedTextService, true));
menu.Items.Add<ActionNew>(LocalizedTextService, true, opensDialog: true);
menu.Items.Add<ActionUpdate>(LocalizedTextService, true, opensDialog: true);
menu.Items.Add<ActionDelete>(LocalizedTextService, true, opensDialog: true);
menu.Items.Add(new RefreshNode(LocalizedTextService, false));
but... it never gets called by the runtime because there is no action associated with that node (id = -1) and is evident by the fact that there are no elipses when you hover over it, and that's the essence of this question. The other 'child' nodes work just fine with the custom action menus.
Ahhh! Sorry my bad! I read it wrong.
In that case you are correct. It has something to do with the CreateRootNode method. It should be this line that removes the elipses root.MenuUrl = null;. I don't know if just removing that line show elipses.
root.MenuUrl = null;
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted