Skip to main content
1-Visitor
October 12, 2018
Question

how to select a menu item via a service

  • October 12, 2018
  • 1 reply
  • 2591 views

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

 

1 reply

5-Regular Member
October 12, 2018

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.

khayes11-VisitorAuthor
1-Visitor
October 16, 2018

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

 

5-Regular Member
October 18, 2018

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.