Udo Schnurpfeil created TOBAGO-1972:
---------------------------------------

             Summary: Sheet sorting: can't sort "Apples with Pears"
                 Key: TOBAGO-1972
                 URL: https://issues.apache.org/jira/browse/TOBAGO-1972
             Project: MyFaces Tobago
          Issue Type: Bug
          Components: Core
    Affects Versions: 4.3.2
            Reporter: Udo Schnurpfeil


It's not possible to sort (and compare) a list of objects using the same 
interfaces. Example:

{code}
  <tc:sheet value="#{fruitBasket.list}" var="fruit">
    <tc:column label="Name" sortable="true">
      <tc:out value="#{fruit.name}"/>
    </tc:column>
  </tc:sheet>
{code}
{code}
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Named
@RequestScoped
public class FruitBasket implements Serializable {

  private List<Fruit> list;

  public FruitBasket() {
    list = new ArrayList<>();
    list.add(new Apple("Golden Delicious"));
    list.add(new Apple("Schöner aus Boskoop"));
    list.add(new Pear("Williams Christ"));
    list.add(new Pear("Köstliche aus Charneux"));
  }

  public List<Fruit> getList() {
    return list;
  }


}

{code}
{code}
public interface Fruit  {

  String getName();

  void setName(String name);
}


{code}
{code}
public class Apple implements Fruit {

private String name;

  public Apple(String name) {
    this.name = name;
  }

  @Override
  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }
}

{code}
{code}
public class Pear implements Fruit {

private String name;

  public Pear(String name) {
    this.name = name;
  }

  @Override
  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }
}

{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to