-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update columns headers on attach
Close #43
- Loading branch information
Showing
4 changed files
with
62 additions
and
10 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...id-flow-demo/src/main/java/com/vaadin/componentfactory/enhancedgrid/GridInDialogView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.vaadin.componentfactory.enhancedgrid; | ||
|
||
import com.vaadin.componentfactory.enhancedgrid.bean.Person; | ||
import com.vaadin.componentfactory.enhancedgrid.filtering.TextFilterField; | ||
import com.vaadin.componentfactory.enhancedgrid.service.PersonService; | ||
import com.vaadin.flow.component.button.Button; | ||
import com.vaadin.flow.component.dialog.Dialog; | ||
import com.vaadin.flow.component.html.Div; | ||
import com.vaadin.flow.component.html.Paragraph; | ||
import com.vaadin.flow.component.icon.VaadinIcon; | ||
import com.vaadin.flow.router.Route; | ||
import java.util.List; | ||
|
||
/** | ||
* Opening grid in a dialog. | ||
*/ | ||
@Route(value = "in-dialog", layout = MainLayout.class) | ||
public class GridInDialogView extends Div { | ||
|
||
public GridInDialogView() { | ||
add(new Paragraph("Opening grid in a dialog")); | ||
|
||
EnhancedGrid<Person> grid = new EnhancedGrid<>(); | ||
grid.setItems(getItems()); | ||
grid.addColumn(Person::getFirstName).setHeader("First Name", new TextFilterField()); | ||
grid.addColumn(Person::getLastName).setHeader("Last Name").setSortable(true); | ||
grid.setFilterIcon(VaadinIcon.FILTER.create()); | ||
|
||
Dialog dialog = new Dialog(); | ||
dialog.add(grid); | ||
dialog.setWidth("800px"); | ||
dialog.setWidth("600px"); | ||
|
||
Button button = new Button("Open dialog to see grid", e -> dialog.open()); | ||
add(button); | ||
} | ||
|
||
private List<Person> getItems() { | ||
PersonService personService = new PersonService(); | ||
return personService.fetchAll(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters