7/4/2025 10:31:25 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
How to enumerate through menus and navbar
Posted: 07 Oct 09 10:57 AM
|
Hi, anyone knows a way to traverse the menu and nav bars at runtime? I.e. I would like to be able to retrieve a list of every navbar (and menu) item at runtime.
A iterable collection of items would be perfect.
Thanks guys!
|
|
|
|
Re: How to enumerate through menus and navbar
Posted: 07 Oct 09 12:36 PM
|
Server side or Client Side?
Client Side, you could look into the Generated Output and determine the class of the Menus and Navigation bars. (E.g. the toolbar items IDs are typically prefixed with "Toolbar_")
Server side, you could do so as well. Get access to a Toolbar, but you may need to know the Menu item that you are looking for (using FindMenu) to locate a NavItemCollection. From there you should be able to enumerate the children.
This example is 7.2.x, but I believe it should work on 7.5.x as well:
Sage.Platform.WebPortal.Services.IMenuService mnuSrc = ToolBar.WorkItem.Services.Get(); NavItemCollection ncSchedule = (NavItemCollection)mnuSrc.FindMenu("mnuSchedule");
From here on, I could iterate through the Items collection....
However,
|
|
|
|
Re: How to enumerate through menus and navbar
Posted: 07 Oct 09 12:51 PM
|
Thanks Raul, it is server side.
The problem is I would like a list of menus and navbar items without any prior knowledge.
In your sample I would need to know that there is a menu called mnuSchedule.
So, I would like to get a list of navbar sections and toolbar menus, then, for each one, a list of items.
Any advice on how to do this?
Thanks a lot!
|
|
|
|
Re: How to enumerate through menus and navbar
Posted: 14 Oct 09 6:25 PM
|
Alberto, Here's some code from my menumodule that hides items based on roles/groups/teams:
if (it == ItemType.Menu) // Hiding menu items { ToolbarWorkspace toolbar = _parentWorkItem.Workspaces["ToolBar"] as ToolbarWorkspace; IMenuService menusvc = toolbar.WorkItem.Services.Get(); NavItemCollection mnugrp = menusvc.FindMenu(sGroupList[0]) as NavItemCollection; if (mnugrp != null) { if (sItem == AllItems) // Hide entire menu toolbar.Controls.Remove(toolbar.FindControl(sGroupList[0])); else // Just remove the item mnugrp.RemoveItem(sItem); } }
if (it == ItemType.NavItem) // Hiding nav bar items { NavWorkspace navbar = _parentWorkItem.Workspaces["NavBar"] as NavWorkspace; NavItemCollection navgroup = navbar.FindControl(sGroupList[0]) as NavItemCollection; if (navgroup != null) { if (sItem == AllItems) // Hide entire nav group navbar.Controls.Remove(navgroup); else // Just remove the item navgroup.RemoveItem(sItem); } }
You can download the whole thing from the partner newsgroups at http://community.sagesaleslogix.com/slsl/board/message?board.id=dev_slx&thread.id=543 (be sure to grab the latest version of the project at the end of the thread), or send me an e-mail direct at mike.laspina@sage.com and I'll send you the project. |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|