You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Click on the button: the button should display the grid and select the first line
=> javascript error. The grid is displayed, but the first line is not selected.
Code example:
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.theme.Theme;
import com.vaadin.flow.theme.lumo.Lumo;
import java.util.Arrays;
import java.util.List;
@Route("table")
@Theme(Lumo.class)
public class TableOnButtonView extends Div {
public TableOnButtonView() {
List<Person> people = Arrays.asList(
new Person("Nicolaus Copernicus", 1543),
new Person("Galileo Galilei", 1564),
new Person("Johannes Kepler", 1571));
Grid<Person> grid = new Grid<>();
grid.setItems(people);
grid.addColumn(Person::getName).setHeader("Name");
grid.addColumn(person -> Integer.toString(person.getYearOfBirth()))
.setHeader("Year of birth");
grid.setVisible(false);
add(grid);
Button click = new Button("click");
click.addClickListener(e -> {
grid.setVisible(true);
grid.getSelectionModel().select(people.get(0));
});
add(click);
}
class Person {
private String name;
private int yearOfBirth;
public Person(String name, int yearOfBirth) {
this.name = name;
this.yearOfBirth = yearOfBirth;
}
int getYearOfBirth() {
return yearOfBirth;
}
String getName() {
return name;
}
}
}
The text was updated successfully, but these errors were encountered:
bisam-rd
changed the title
Javascript error on display and select a grid
Javascript error when display and select a line of a grid
Jul 26, 2018
Scenario:
=> javascript error. The grid is displayed, but the first line is not selected.
Code example:
The text was updated successfully, but these errors were encountered: