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,
$(".dataviewsample").css("display","none");
$(".btnone").click(function(){
$(".dataviewsample").show();
});
$(".btntwo").click(function(){
$(".dataviewsample").hide();
});
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.
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.