cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

how to select a menu item via a service

khayes1
13-Aquamarine

how to select a menu item via a service

Hi,

does anyone know if there is there a way to select a menu item via a service or some logic. In one of my mashups I use a dynamic menu widget which drives a contained mashup. There are times when I wish to refresh the whole mashup but keep the menu item last selected, rather than go back to the default menu item.

 

Thanks,

K

 

5 REPLIES 5
CRArko
17-Peridot
(To:khayes1)

Hello.

 

Is your use case something like this?

 

  • Create a Mashup with a List and a Menu Widget, configured to Data Driven, to make it dynamic
  • Call a service returning entities e.g. list of menu items within an Infotable with MenuEntry DataShape, and bind all data returned from the service to the Menu and to the List e.g. the MenuID
  • This will form the Menu option finally visible to the users at runtime

If not, can you describe in more (verbose) detail for me? I'm not sure you can do what you're asking for, but I can try to replicate your use case and test it.

 

Thanks,

 

-- Craig A.

khayes1
13-Aquamarine
(To:CRArko)

Hi Craig,

thanks for the reply, sorry its taken a while for me to get back to you. Ideally I was looking for an implementation that didn't involve me having a list where the user selects a menu item. My issue is that I have a contained mashup driven by a menu. The menu has a default item which it goes to on loading. From time to time I have reason to want to refresh the whole mashup (including the menu). I'm actually creating an interface that allows foreign users to add their own translations for the tokens. Ideally I would like the menu to remember the item selected (and therefore the contained mashup page) and not default back to the default item.

 

I can record the last selected item in a session parameter, so what I'm looking for is a service that I can use to force the menu to select that last used item. Hope that is a bit clearer.

 

Thanks,

K

 

Actually if you put the Menu in the Master and refresh only the contained Mashup you're using, it will be fine (the data sending to the Menu item will be defined in the Master page, so when the mashup is refreshed, the Menu item service will not be affected), but since you want to refresh the menu as well, this method will fail.

 

Would you like to try Session Variables? You can store the previous selected Menu item name in the session part and keep it during the refresh. I didn't test it but that's the only way I can think of.

khayes1
13-Aquamarine
(To:zyuan1)

Hi, thanks for the reply. I like the idea of using a Master, and now wish I had done that from the start. Unfortunately we have to many mashups at this point, so would require quite a bit of work.

 

I do record the menu item selected in a session variable, the problem I have is I can't find a way/service that I can use to select a menu item programmatically. If you do know of a way that would be great.

 

Thanks again,

K

 

I can't recall a way to deal with Selecting Menu Item through services, because that's a UI interaction.

 

The only way I know is that you could use a service to send the MashupName property you need to a Navigate (could be invisible) widget, and it's triggered by the time you finished that service (service invoke complete event). Thus you can choose to go to whichever Mashup that's in or not in your Menu Item list.

Top Tags