Welcome Guest Search | Active Topics | Sign In | Register

Menu item removal based on user role Options
Mike Wynn
Posted: Wednesday, August 27, 2008 3:52:11 AM
Rank: Advanced Member
Groups: Member

Joined: 8/24/2007
Posts: 130
Hi,

I am using the menu system, which is bound to my site map. I am specifiying roles with the sitemap to control whether certain menu items appear.

I have a requirement to also be able to remove menu items base on particular roles. Is there any support for this?

Regards
Phil Wynn
eo_support
Posted: Wednesday, August 27, 2008 6:03:43 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You can set each menu item's AllowRoles property and HideRoleDisabledItems to true. That way the menu can disable, then hide menu items that does not meet the roles. Note the items are not deleted.

If that can not meet your requirement. You will need to code for it. It will be something like:

Menu1.Items.RemoveAt(0);

Thanks
Neal
Posted: Wednesday, August 3, 2011 5:46:54 PM
Rank: Newbie
Groups: Member

Joined: 8/3/2011
Posts: 4
Hello,

I'm looking at using your Treeview with the contextmenu. I have the same need as above. I have a Treeview that I want to show/hide contextmenu item based on the text of the treeview item clicked. For example, if the user clicks on an errored task I want to allow them to Requeue the task, but if the task shows Queued I don't want that option to show. Roles doesn't seem to be the best solution here. What do you suggest?
eo_support
Posted: Wednesday, August 3, 2011 6:09:22 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You would just modify the context menu (changing item text, show/hide items) before you show it. See here for a working example:

http://demo.essentialobjects.com/Demos/TreeView/Features/Context%20Menu/Demo.aspx

This sample modifies the context menu item text to include the tree node text. You can also show/hide any context menu item.

If you have not used our client side JavaScript interface before, you will want to take a look of this topic:

http://doc.essentialobjects.com/library/1/clientapi_howto.aspx

Hope this helps. Please feel free to let us know if you have any more question.

Thanks
Neal
Posted: Thursday, August 4, 2011 8:50:30 AM
Rank: Newbie
Groups: Member

Joined: 8/3/2011
Posts: 4
Thanks, that worked. Took me forever to find the method to call in JavsScript.

menu.getTopGroup().getItemByIndex(0).setVisible(false);
eo_support
Posted: Thursday, August 4, 2011 8:55:09 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Glad to hear it works! Please feel free to let us know if you have any more questions.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.