HI again

 

I checked, and the problema is not the sorting method, it Works fine

But the problems Is in the view, It doesn't refresh the list

Ideas?

 

________________________________

De: Bravo Villegas Salvador Francisco [mailto:[EMAIL PROTECTED] 
Enviado el: Viernes, 30 de Mayo de 2008 12:54 p.m.
Para: MyFaces Discussion
Asunto: [Tobago] Sorting problems

 

Hi All,

 

I'm having troubles with the sort of a sheet in Tobago.

But the info in the sheet doesn't get sorted by the column selected.

 

What can be the problem?

Any suggestion? 

 

In my JSP:

<tc:sheet ........... . . . . . 

      . . . . . . . .

      sortActionListener="#{accessBean.sheetSorter}">

<tc:column label="#{overviewBundle.userLoginUser}"

            id="userName" sortable="true" align="center">

 

In my Class:

public void sheetSorter(ActionEvent event) {

            if (event instanceof SortActionEvent) {

                  SortActionEvent sortEvent = (SortActionEvent) event;

                  UIData sheet = sortEvent.getSheet();

                  SheetState sheetState 

                        =
sheet.getSheetState(FacesContext.getCurrentInstance());

                  String columnId = sheetState.getSortedColumnId();

                  List<UserLogin> list = (List<UserLogin>)
sheet.getValue();

                  Comparator<UserLogin> comparator = null;

                  if ("userName".equals(columnId)) {

                        comparator = new Comparator<UserLogin>() {

                             public int compare(UserLogin o1, UserLogin
o2) {

                                   return
o1.getUserName().compareTo(o2.getUserName());

                             }

                        };

                  } 

                  Collections.sort(list, comparator);

                  for (Iterator iter = list.iterator(); iter.hasNext();)
{

 
System.out.println(iter.getClass().getName().toString());

                  }

                  if (!sheetState.isAscending()) {

                        Collections.reverse(list);

                  }

            }

 

 

Regards

Reply via email to