You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mnwicket <le...@gmail.com> on 2008/04/04 19:05:11 UTC

Sorting and ListView

I'm using a ListView to display contents of a List of a domain object. 
Pretty simply.  However, the domain has a name on it that is
internationalized, ie it will used a key value from a dot properties file. 
The issue is is that the List of object must be sorted based on the
internationalized value of the name.  Currently I'm using the localizer to
get the internationalized values and then sorting the List but the localizer
complains, something about not being attached to a page yet.  Does anyone
else have a better way of doing this?
-- 
View this message in context: http://www.nabble.com/Sorting-and-ListView-tp16493832p16493832.html
Sent from the Wicket - User 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: Sorting and ListView

Posted by always_rick <sh...@hotmail.com>.

lenzenc wrote:
> 
> 
> This issue isn't about how to sort, this issue is at what point do you
> grab
> the translated name.
> 
> 

Did you solve this problem? I am having same problem. I totally agree with,
"it isn't about how to sort, ...". 

I am new in wicket. Any sample code will be appreciated.

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Re-Sorting-and-ListView-tp1861768p2293509.html
Sent from the Wicket - User 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: Sorting and ListView

Posted by mnwicket <le...@gmail.com>.
This issue isn't about how to sort, this issue is at what point do you grab
the translated name.


Mathias P.W Nilsson wrote:
> 
> Couldn't you just use the Comparator? Add all items to a list, with the
> translated name
> implement Comparator and make the sort. Return the sorted list as a model.
> 

-- 
View this message in context: http://www.nabble.com/Sorting-and-ListView-tp16493832p16494145.html
Sent from the Wicket - User 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: Sorting and ListView

Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
Couldn't you just use the Comparator? Add all items to a list, with the
translated name
implement Comparator and make the sort. Return the sorted list as a model.
-- 
View this message in context: http://www.nabble.com/Sorting-and-ListView-tp16493832p16494143.html
Sent from the Wicket - User 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: Sorting and ListView

Posted by Edvin Syse <ed...@sysedata.no>.
> I'm using a ListView to display contents of a List of a domain object. 
> Pretty simply.  However, the domain has a name on it that is
> internationalized, ie it will used a key value from a dot properties file. 
> The issue is is that the List of object must be sorted based on the
> internationalized value of the name.  Currently I'm using the localizer to
> get the internationalized values and then sorting the List but the localizer
> complains, something about not being attached to a page yet.  Does anyone
> else have a better way of doing this?

The problem arises because you do the sorting in the constructor of the page, where i18n-info might not be available (depending on how the 
page was constructed). Wrap the sorting in a LoadableDetachableModel and return the sorted list from that and pass it to the listview. This 
way, the list isn't constructed before it is consulted the first time, and then the page will know about i18n-settings.

-- Edvin

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