You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Simon B <si...@gmail.com> on 2015/02/19 11:34:35 UTC
Determine Last Item in a ListView
Hi,
First of all thank you for creating Wicket its awesome, now that I'm a bit
more familiar with it, I'm continually delighted by it.
Secondly could someone tell me what the best way of determining whether an
item passed to the method:
protected void populateItem(ListItem<?> item);
is the last item?
Cheers
Simon
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Determine-Last-Item-in-a-ListView-tp4669641.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Determine Last Item in a ListView
Posted by Tobias Soloschenko <to...@googlemail.com>.
Hi,
even better! That's the way I would do it by myself! :-)
kind regards
Tobias
> Am 19.02.2015 um 12:05 schrieb Simon B <si...@gmail.com>:
>
> Hi Tobias,
>
> Thanks for your answer.
>
> I've decided to use the ListView#getViewSize method
>
> so my check is as follows:
>
> if ((item.getIndex() + 1) == getViewSize()) {
> // do last item stuff here
> item.add(new AttributeModifier("class",
> "lastItemClass"));
> }
>
> Cheers
>
> Simon
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Determine-Last-Item-in-a-ListView-tp4669641p4669643.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Determine Last Item in a ListView
Posted by Simon B <si...@gmail.com>.
Hi Tobias,
Thanks for your answer.
I've decided to use the ListView#getViewSize method
so my check is as follows:
if ((item.getIndex() + 1) == getViewSize()) {
// do last item stuff here
item.add(new AttributeModifier("class",
"lastItemClass"));
}
Cheers
Simon
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Determine-Last-Item-in-a-ListView-tp4669641p4669643.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Determine Last Item in a ListView
Posted by Tobias Soloschenko <to...@googlemail.com>.
Hi,
you can get the index of the item with ListItem.getIndex() and compare it with the last index of the model object.
kind regards
Tobias
> Am 19.02.2015 um 11:34 schrieb Simon B <si...@gmail.com>:
>
> Hi,
>
> First of all thank you for creating Wicket its awesome, now that I'm a bit
> more familiar with it, I'm continually delighted by it.
>
> Secondly could someone tell me what the best way of determining whether an
> item passed to the method:
>
> protected void populateItem(ListItem<?> item);
>
> is the last item?
>
> Cheers
>
> Simon
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Determine-Last-Item-in-a-ListView-tp4669641.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org