How to hide empty list view if you cant do it with a attribute in object above

0
Hi guys, As you may know, list view is giving ugly empty row (no resuls fount or something in it) if it has no results in it. I am wondering what you guys do to hide this row in a case where you can't solve it by (adding) a visibility attribute in the object above. In my case is the domain model: (Request) 1- N Offer__Request (Offer) & (Supplier)1- N Supplier__Offer (Offer) I thought to making a helper entity which holds a boolean true or false on basis of the supplier sent a offer to this request. Side-effect of this is each time a lot of unnecessary work.....do you have a simpler solution?
asked
4 answers
8

hiding the element isn't hard, its replacing it that proves a challange.

to hide the element add this to your sass:

.mx-listview > ul.mx-list.mx-list-striped.mx-listview-list > li.mx-listview-empty {
  display: none
}

 

answered
0

I did a work around with this, that text that says "No Items Found" has a class associated with it, I believe it is .mx-list-empty or something similar to this. I set the color of the text to transparent, so that "No Items Found" would not appear. it is just a workaround, but it works for me, hopefully it helps.

answered
0

add thsi to your scss.

.listview-afterempty{

display: none;

}


.mx-listview:has(.mx-listview-empty) + .listview-afterempty{

display: block

}


the directly after you listview, have a container with class listview-afterempty.


tadaa, if the listview is empty, the afterempty will be shown.

answered
0

hi,


You do not need a helper entity for this.

The “No items found” row in a List View is default Mendix behavior when the data source returns an empty list. The correct way to handle this is through Conditional Visibility, not by changing your domain model.

Solution

If your List View is inside a Data View of Request and the data source is the association:


Offer__Request

Wrap the List View inside a Container and set Conditional Visibility on that container to:


not(empty($Request/Offer__Request))

This hides the List View completely when there are no related Offers.

If you want to show a custom message instead, add another container with:


empty($Request/Offer__Request)

and place your own message there.

answered