Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComponentRenderer for Grid #2720

Closed
pleku opened this issue Oct 19, 2017 · 1 comment
Closed

ComponentRenderer for Grid #2720

pleku opened this issue Oct 19, 2017 · 1 comment

Comments

@pleku
Copy link
Contributor

pleku commented Oct 19, 2017

When showing a grid to the users, I want them to be show them any component there without using html/templates, so that I can be efficient by using the high level APIs

Grid<Department> grid = new Grid<>();
grid.addColumn("Chief", Department::getPerson,
  new ComponentRenderer<>(PersonCard::new, PersonCard::setPerson));

public class PersonCard extends Div {
  private Person person;

  public PersonCard() {
    getElement().addListener("click",
      e -> System.out.println("You clicked " + person.getName()));
  }

  public void setPerson(Person person) {
    this.person = person;
    setText(person.getName());
  }
}

Please see the concept idea documentation for more information https://docs.google.com/document/d/1wS4lShVLix5Q97c3hANH33blHRYHtHFESeCotC8I7oE/edit#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants