Having some alternate text/markup displayed is commonly what we do since if
a user expects to see something at a point in the page, and we no longer
show anything, that becomes confusing for the user.  Our current usage of
ListView for all customer/public facing pages is:

<div wicket:id="empty-lv">
    Text to show in case of empty ListView
</div>
<div wicket:id="listview">
    ...
</div>

We also hide the listview in the empty case using the same mechanism as you
described.  Since we do this for all ListViews (or nearly all - the only
exceptions being admin/dev/debug pages) it would be nice to have this
seemingly common functionality as part of the provided component.

If that alternate text ('empty-lv') could be produced/contained inside the
ListView markup, that would be great (since then spacing/styling on the
page becomes easier) as the ListView dom element position/size/whatever can
be fixed

Could we make such a change, and then have a flag on the ListView (or
simply inferred from the presence of the "alternateEmptyText" property)
whether to render the LV repeater or the alternate text?

N


On Mon, May 5, 2014 at 9:13 AM, Martijn Dashorst <[email protected]
> wrote:

> One of the things I dislike is when I have to implement my own
> visibility logic when a ListView is empty, mostly when using
> enclosures to wrap around surrounding markup.
>
> So for a ListView<Address> I have to implement an onConfigure that
> calls setVisible(!getList().isEmpty()); to tell the enclosure that it
> should not render the enclosed markup.
>
> <wicket:enclosure child="addresses">
> <h2>Addresses</h2>
> <dl>
> <wicket:container wicket:id="addresses">
>   <dt>Address</dt>
>   <dd><wicket:container wicket:id="address"></wicket:container></dd>
> </wicket:container>
> </dl>
> </wicket:enclosure>
>
> I figure we can make that the default. There is little point in having
> a visible, empty ListView, is there?
>
> Another option would be to make wicket:enclosure smarter, but that is
> a rabbit hole I'd like leave closed.
>
> Martijn
>

Reply via email to