How to show/hide content in the page on click of button?

Hi, I want to show(make visible) one layoutGrid below my button1 - on click on this button1. Also if it layoutGrid is visible again on click of same button1 I want to hide it.  On visible button color should be different so has to indentify that grid is visible. I tried this with microflow but did'nt worked out. I am new in mendix. Anyone had done such thing Please suggest or share. Thanks in advance.
3 answers

Hi Kavya,

If I understand correctly, a click on a button should reveal and hide a layoutGrid?

You can create a boolean on the entity of your screen (for instance: 'showExtraContent') that you flip from true to false or vice versa in the microflow. This boolean can be selected as determining the visibility in the 'Visibility' part of the layoutGrid. Alternatively, if there are other values being changed in the microflow, you can use that to determine conditional visibility: that way you don't have to create a new boolean attribute for it.

Does that answer your question?


Did you try the ShowByCondition widget which is in the AppStore. No need for an extra attribute and base showing/hiding on the outcome of a to be configured microflow which returns a boolean.


Create an entity with the attribute and let is name visible. Create a dataview with a datasource microflow that creates a new object and returns that object. In the dataview place two containers. One container is shown when visible is true while the other is shown when false. Now the button should trigger a microflow where you pass the object as parameter and the only thing this microflow does is set the boolean in the other state that it is now. So set it to false if the current state is true and vice  versa. Do not forget to refresh the object. Committing the object is not necessary.