You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Hans Lesmeister 2 <ha...@lessy-software.de> on 2011/06/21 15:12:14 UTC

Re: Drop

Hi, 


FeanorsCurse wrote:
> 
> Instead of using the getName()-method it's using toString, despite of what
> is set in the property model. As far as I understand, this is because
> getName() returns a String and not a UserAccountEntity itself.
> ...
> Any advice?
> 

You can use a IChoiceRenderer and pass that to the DropDownChoice along with
your Model and the List. The renderer is used to get the String to be
displayed.


-----
-- 
Regards, 
Hans 

http://cantaa.de 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Drop-tp3613805p3614012.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: Drop

Posted by Mike Mander <wi...@gmx.de>.
Am 22.06.2011 06:54, schrieb Hans Lesmeister 2:
> FeanorsCurse wrote:
>> However, I still feel like that is an unnecessary step; I don't see any
>> reason why the PropertyModel should not be enough on its own.
>>
> Please correct me if I am wrong: The model passed in tells the dropdown
> which object from the list should be the active one shown. If you don't
> apply a renderer then some default is used to render the options and that is
> obviously toString() on each object in the list. Ergo: The result object
> from evaluating the model should be the same type as the objects in the
> list.
>
> -----
Correct. But if you don't use a renderer they have to be the same 
instance to. Otherwise
equals used by list is not recognizing "same object". The renderer takes 
that part with
the String getIdValue(T object, int index); method. Here you can 
implement the equals
logic.

Cheers
Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Drop

Posted by Hans Lesmeister 2 <ha...@lessy-software.de>.
FeanorsCurse wrote:
> 
> However, I still feel like that is an unnecessary step; I don't see any
> reason why the PropertyModel should not be enough on its own.
> 

Please correct me if I am wrong: The model passed in tells the dropdown
which object from the list should be the active one shown. If you don't
apply a renderer then some default is used to render the options and that is
obviously toString() on each object in the list. Ergo: The result object
from evaluating the model should be the same type as the objects in the
list.

-----
-- 
Regards, 
Hans 

http://cantaa.de 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Drop-tp3613805p3616016.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