i have a table contains 3 columns, when the user clicks in one of them the 
table should be sorted, i'm using AsyncDataProvider, the sort for the first 
column works fine, so i should do the same to the others columns. this is 
the code :

AsyncDataProvider<PermisoUI> providerPerfiles = new 
AsyncDataProvider<PermisoUI>() {

    @Override
    protected void onRangeChanged(HasData<PermisoUI> display) {

        if(sortedPermiso) {
            sortedPermiso=false;
            class TipoCuotasComparator implements Comparator<Object> {
                public int compare(Object l1, Object l2) {
                    PermisoUI o1 = (PermisoUI) l1;
                    PermisoUI o2 = (PermisoUI) l2;
                    return o2.getId().compareTo(o1.getId());

                }
            }
            Collections.sort(listPermisos, new TipoCuotasComparator());
        }else {
            sortedPermiso = true;
            class TipoCuotasComparator implements Comparator<Object> {
                public int compare(Object l1, Object l2) {
                    PermisoUI o1 = (PermisoUI) l1;
                    PermisoUI o2 = (PermisoUI) l2;
                    return o1.getId().compareTo(o2.getId());
                }
            }
            Collections.sort(listPermisos, new TipoCuotasComparator());
        }

        int start = display.getVisibleRange().getStart();
        int end = start + display.getVisibleRange().getLength();
        end = end >= listPermisos.size() ? listPermisos.size() : end;
        List<PermisoUI> sub = listPermisos.subList(start, end);
        updateRowData(start, sub);

    }
};



providerPerfiles.addDataDisplay(CellTblPermisos);

//Sorting Column
AsyncHandler columnSortAplHandler = new AsyncHandler(CellTblPermisos);
CellTblPermisos.addColumnSortHandler(columnSortAplHandler);
CellTblPermisos.getColumnSortList().push(permisoColumn);


    providerPerfiles.addDataDisplay(CellTblPermisos);
providerPerfiles.updateRowCount(listPermisos.size(), true);
PPerfil.clear();
PPerfil.add(CellTblPermisos);

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to