You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Boris Goldowsky <bg...@cast.org> on 2019/06/28 15:25:27 UTC
Enclosure around a RefreshingView
What’s the best practice for a list (built in this case with a RefreshingView) that has a header, which should be hidden if the list is empty?
The most obvious would be to wrap <wicket:enclosure> around the whole thing, but the RefreshingView is still considered visible even when empty, so that doesn’t work by itself.
I tried adding an onConfigure method to set visibility based on the repeater’s size(), but the children don’t actually get added to the repeater until after onConfigure runs, so size() always returns 0.
There are ways I can brute force this of course. But is there a clean, general solution?
Boris
Re: Enclosure around a RefreshingView
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
On Fri, Jun 28, 2019 at 6:25 PM Boris Goldowsky <bg...@cast.org> wrote:
> What’s the best practice for a list (built in this case with a
> RefreshingView) that has a header, which should be hidden if the list is
> empty?
>
> The most obvious would be to wrap <wicket:enclosure> around the whole
> thing, but the RefreshingView is still considered visible even when empty,
> so that doesn’t work by itself.
>
> I tried adding an onConfigure method to set visibility based on the
> repeater’s size(), but the children don’t actually get added to the
> repeater until after onConfigure runs, so size() always returns 0.
>
Actually the children are added
in org.apache.wicket.markup.repeater.AbstractRepeater#onBeforeRender(), so
you need to override this one, call super.onBeforeRender() and then check
the size.
I'd recommend you to use EnclosureContainer instead of <wicket:enclosure>
because the latter has many known bugs.
>
> There are ways I can brute force this of course. But is there a clean,
> general solution?
>
> Boris
>
>