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 coul开发者_如何学Pythond do this when setting the dataProvider
, but it seems like there should be an event or something else that I could be using.
You could try
visible="{myList.dataProvider.length>0}"
includeInLayout="{myList.dataProvider.length>0}"
where "myList" is the id of your List component.
My first solution to this was to override set dataProvider:
override public function set dataProvider(value:IList):void {
super.dataProvider = value;
this.setVisible(value.length > 0);
}
This did work, however Robusto's solution works also and is preferable IMO.
精彩评论