You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Catalin Kormos (JIRA)" <de...@myfaces.apache.org> on 2007/01/20 15:53:30 UTC

[jira] Resolved: (TOMAHAWK-864) Sorting by locale in FacesContext for strings (SortableModel)

     [ https://issues.apache.org/jira/browse/TOMAHAWK-864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Catalin Kormos resolved TOMAHAWK-864.
-------------------------------------

    Resolution: Fixed

> Sorting by locale in FacesContext for strings (SortableModel)
> -------------------------------------------------------------
>
>                 Key: TOMAHAWK-864
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-864
>             Project: MyFaces Tomahawk
>          Issue Type: New Feature
>          Components: Extended Datatable
>    Affects Versions: 1.1.3, 1.1.4-SNAPSHOT, 1.1.5-SNAPSHOT
>            Reporter: Tomislav Jakopec
>         Assigned To: Catalin Kormos
>            Priority: Trivial
>             Fix For: 1.1.5-SNAPSHOT
>
>
> I have small problem and I don't now how to handle.
> So far I write my own Comparator in witch I sorted according to Collator with locale form FacesContext
> Collator collator = Collator.getInstance(
>                                                 FacesContext.getCurrentInstance().getViewRoot().getLocale());
> My sort order was fine, Croatian letters where sorted alphabet.
> Now there is possibility to tel whole datatable sortable="true" and I don't have to write commandSortHeader tag.
> Problem: sort is alphabet in english language, not croatian and
> FacesContext.getCurrentInstance().getViewRoot().getLocale() is croatian 
> The solution:
> If you look in the org.apache.myfaces.component.html.ext.SortableModel (inner class Comp), the default comparator that is used to sort the values in a given column, will compare the values as Comparable if they implement that interface, if not it will compare them as simple strings, obtained by toString().
> This makes me think that the usage of the Collator class to compare those strings would do it, thanks for pointing that out, btw. It would be great if you could open a Jira issue for this, and even greater, if possible, to provide a patch, it would be of great help having this resolved faster.
> Regards,
> Catalin

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira