conditional visibility if 1-* = empty - Mendix Forum

conditional visibility if 1-* = empty

1

if a listview is empty, we would like to hide the container that the listview is inside.

 

for instance, if a client has no job order connected, then we don't need to show the container with the title Joborders.

 

JobOrder_Client/JobOrders.JobOrder != empty

 

 

asked
3 answers
add this allow you to pop a class as direct first child of the listview.
add the class listview-afterempty, and it wills how if the listview is empty.


.listview-afterempty{
  display: none;
}

.mx-listview:has(.mx-listview-empty) + .listview-afterempty{
  display: block
}
Created

Depending on your browser compatibility requirements the CSS has selector would work.

 

https://caniuse.com/css-has

https://css-tricks.com/the-css-has-selector/

 

Where you can just whether it has an "li" HTML element inside of it. And if not you set display: hidden; visibility: none;

Created

related post

 

https://community.mendix.com/link/space/app-development/questions/129223

Created