Sorry, this is probably a really easy to answer question, but how in Flex can I display a message within a Spark List component that states that the List is empty. For example if I have a List showing number of jobs outstanding, if my List is empty then I want a message displayed across the List stating “there are no jobs to perform”.
I’d rather not use an Item Renderer because then it’s an Item (the list is not empty) and the item can be selected.
This seems like it should be very trivial and I hope it is.
Thanks in advance,
Phil
You could work with an overlay that will only be shown if the dataprovider has no items, like so:
You could also use states instead of the binding between ‘visible’, ‘includeInLayout’ and ‘dp.length’
Edit: if you would like this behavior in all your List components, you can create a custom skin for List, like this:
This is a trimmed down version of the skin class, but to summarize: all you do is add that overlay Group to the original Spark ListSkin in exactly the same way as in the previous example.
Apply it to all List components with CSS: