I’ve been trying to add an interactive nav icon to our top menu bar.
So far I have:
created a widget
found the addHeaderPanel and called api.addHeaderPanel('custom-menu-button', 'customMenu')
However, this is where I get stuck… it looks like (according to the code) the panel will only show if the header widget state has {customMenu: true} in it… and for the life of me I cannot figure out how to set/override the state…
This panel will ultimately need to toggle it’s own state property (open/closed) to change the icon state, and also to send an action out to render a component with the menu. (unfortunately, it’s full-screen so I can’t nest it in the header Panel)
I had this working with a component pretty quickly, but the new virtual DOM is taking some adjustment mentally.
I managed to work around this now by just introducing a service and by-passing the state management entirely, but I think it would still be good to get some clarifications around how this should properly work.
The service implementation I have is a bit limited since it can’t really loop back in and update the widget state effectively.
Sorry, I just read this bit. I think the whole point of widget state is that it’s self-contained and doesn’t leak out into other parts of the app, so not sure I have a solid recommendation here. Have you looked into using Ember.evented, to emit events that the header can listen to, perhaps?