Skip to content

Commit

Permalink
fix: remove redundant sorter renderer (#538)
Browse files Browse the repository at this point in the history
Fixes: vaadin/vaadin-grid#1841.
Cherry-pick: #515
  • Loading branch information
yuriy-fix authored Dec 20, 2020
1 parent c141068 commit a8a8e6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.vaadin.flow.component.grid.GridSortOrderBuilder;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.NativeButton;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.data.bean.Person;
import com.vaadin.flow.router.Route;

Expand Down Expand Up @@ -69,10 +70,14 @@ private Grid createGrid(String gridId, String sortBtnId) {
grid.setItems(new Person("B", 20), new Person("A", 30));

Column<Person> nameColumn = grid.addColumn(Person::getFirstName)
.setHeader("Name");
.setHeader(new Span("Name"));
Column<Person> ageColumn = grid.addColumn(Person::getAge)
.setHeader("Age");

// Needed to check that sorter is rendered in component header after
// adding new header row
grid.appendHeaderRow();

List<GridSortOrder<Person>> sortByName = new GridSortOrderBuilder<Person>()
.thenAsc(nameColumn).build();
grid.sort(sortByName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@ protected void setFooterText(String text) {
}

protected void setHeaderComponent(Component component) {
/*
* Uses the special renderer to take care of the vaadin-grid-sorter.
*/
setHeaderRenderer(new GridSorterComponentRenderer<>(this, component));
setHeaderRenderer(new ComponentRenderer<>(() -> component));
}

protected void setFooterComponent(Component component) {
Expand Down

This file was deleted.

0 comments on commit a8a8e6e

Please sign in to comment.