Sorting a tree

Hi, I’m using Vaadin 6.7, and I have a tree of strings which needs to be sorted in a special way. I have created a class that implements ItemSorter, and I add it like this:

  HierarchicalContainer beans = new HierarchicalContainer();
  Tree subscriberTree = new Tree();
  beans = this.generarContainer(subscribers);
  beans.setItemSorter(new MySorter());

But the compare() method in MySorter never gets invoked. Is there something I’m doing wrong?


are you calling the
method on your
anywhere in your code? You should call the method to explicitly trigger sorting on the container.

Hi Teemu, and thanks, that seems to work now. At least the compare method gets called.
Although I still don’t get how to call the sort() method in the container, why do we have to pass the array of propertyIds and another array of booleans? Shouldn’t it just sort them all (i.e a method sort with no parameters)?