Show username in layout header

0
Hi, I want to make a little menu in the header in the layout. Is there any way to make a kind of menu to logout or go to my account? The title of the menu needs to be to currentUser. I know i cant put a attribute in the header because it needs a dataview, but is there any work around for this? Kind regards, Sonny
asked
4 answers
7

Snippets can be used in a layout, so you could create a snippet with a dataview with the current account and go from there. View the images below. The snippet is a snippet with no 'caller'. Only a dataview based on a microflow is present, see image 1. With this you can just put the snippet in the layout, as shown in image 2.

  1. Snippet

  2. Mendix layout

answered
1

Try these search results:

https://forum.mendix.com/questions/8826/Menucaption-based-on-attributevalue https://forum.mendix.com/questions/4829/Widget-username--logout-ect-like-homemendixcom

answered
1

You can have a dataview in a Snippet with a microflow as a datasource.

In this microflow retreive (first) an account from your database with

[id = '[%CurrentUser%]']

Now you have access to all account information in this Snippet (which you can place in a layout)

answered
1

One solution that i have used is to leverage the ideas that have already been shared plus one special widget from the app store.

  1. Create a snippet as noted above.
  2. Place in the layout, in the header for example.
  3. Put a container around the snippet in the layout
  4. Put the DropdownDivConverter (https://appstore.home.mendix.com/link/app/2089/Mendix/DropdownDivConverter) in the container as the last item.

This can be used for things like the user profile info (like logout), shopping carts, or anything where a nice set of data or list can come in handy. See the widget for more ideas.

answered