But I guess most of the time you have an empty list you want to hide not
only the list, but also some markup around it (thus the use of an
enclosure), so just changing the HTML generated by the empty list would not
be enough.

I think the ListView should be invisible when empty. Besides that, the
enclosure could be smarter and render an alternate (static) markup instead
of just becoming invisible. But that would be another topic of discussion :)


“The truth is rarely pure and never simple.” ― Oscar Wilde


On Mon, May 5, 2014 at 10:29 AM, Nick Pratt <nbpr...@gmail.com> wrote:

> 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 <
> martijn.dasho...@gmail.com
> > 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