GwtMaterialDesign / gwt-material-table

A complex table component designed for the material design specifications
https://gwtmaterialdesign.github.io/gmd-table-demo/
Apache License 2.0
26 stars 31 forks source link

Compatibility problems GwtMaterial table 2.1.1 and 2.2-SNAPSHOT #178

Open HoochSDS opened 5 years ago

HoochSDS commented 5 years ago

1) The order of column and header Argument are different in 2.2-SNAPSHOT, causing errors! GwtMaterial table 2.1.1.

  public final void addColumn(Column<T, ?> column, String header)  { 
    this.view.addColumn(column, header);
  }

GwtMaterial table 2.2-SNAPSHOT

  public final void addColumn(String header, Column<T, ?> column) {
    this.view.addColumn(header, column);
  }

Demo Example column definition: error in 2.2-SNAPSHOT

    table.addColumn(new TextColumn<Person>() {
      @Override
      public String getValue(Person object) {
        return object.getFirstName();
      }
    }, "First Name");

2) 'sortComparator()' cannot override 'sortComparator()' in 'gwt.material.design.client.ui.table.cell.Column'; overridden method is final

    table.addColumn("Last Name", new TextColumn<Person>() {
      @Override
      public Comparator<? super RowComponent<Person>> sortComparator() {
        return (o1, o2) -> o1.getData().getLastName().compareToIgnoreCase(o2.getData().getLastName());
      }

      @Override
      public String getValue(Person object) {
        return object.getLastName();
      }
    });

Thanks

BenDol commented 5 years ago

With 2.2 you need to pipe the configurations on the Column. Like so:

    table.addColumn("Last Name", new TextColumn<Person>() {
      @Override
      public String getValue(Person object) {
        return object.getLastName();
      }
    }
    .sortComparator((o1, o2) -> o1.getData().getLastName().compareToIgnoreCase(o2.getData().getLastName())));

The demo samples still need to be updated for the 2.2-SNAPSHOT