Search code examples
apache-flexdataprovider

How can I hide a list component when it contains no items?


I have a List of items which is based on the contents of the "category" that a user selects

When the user changes selection, I change the dataProvider of the list be be the contents of the current category.

Sometimes the list contains items, sometimes it does not

Is there a way of hiding the list when it has no items?

I know that I could do this when setting the dataProvider, but it seems like there should be an event or something else that I could be using.


Solution

  • You could try

    visible="{myList.dataProvider.length>0}"
    includeInLayout="{myList.dataProvider.length>0}"
    

    where "myList" is the id of your List component.