Sorting entries in a Select

Hi there,

The data source feeding my Select gives me un non-sorted result-set (e.g. Paris, Amsterdam, New-York). Is there a simple way to sort the entries (say alphabetically) at component level (to display Amsterdam, New-York, Paris to the user) ?

Thanks in advance,


You can use the container to sort the items. For example, if your select uses an IndexedContainer (which implements Container.Sortable), then you can use the sort() method to sort your items.

Hi Kim,

I changed

            List<DataObject> l = getObjectListFromDb();
            for (DataObject r: l){
            if (l.size()>0){


            Collection<DataObject> l = getObjectListFromDb();
            BeanItemContainer c = new BeanItemContainer(l);

            c.sort(new String[]{"dataObjectIndex"}, new boolean[]
            if (c.size()>0){

and it works as expected.

Thanks a lot,