Hiding and showing dataview when clicking on a button

Hi,   May I know if it is possible to hide and show a dataview when a user clicks on a button please? For example, I have 2 different buttons. 1 button is supposed to show the dataview while the other is to hide it. It sounds like it is possible to do in Mendix but I have no idea how. Do I make use of enumeration to do so?
3 answers

Yes its possible. We can implement this hide and show in JS/JQuery widget or CSS/Sass file. Just assign the class name in current dataview and also in particular buttons. For example, If dataview class name as "dataviewsample" then button class name as "btnone" and "btntwo". Atlast implement the javascript widget, then write code as,

Jquery code,









My app security is in production mode, and right now I am hiding based on selected roles. Is it possible to use conditional visibility for both selected roles and hiding the current dataview? 


My buttons are 2 separate buttons, so I am not sure which method suits me. I do not mind learning both ways ( JS/CSS) and conditional visibility from scratch, if it is ok. 


If you don't want to use JS / CSS, you can simply use conditional visibility on your data view that's based on an attribute (boolean). Make the buttons toggle the boolean to its opposite value and your data view will hide / unhide itself.

Alternatively, if you just want users to be able to hide / unhide the view and it doesn't really matter how, you could consider a group box. That allows users to collapse everything inside the group box.