Hi All,
I’m following a sample from [start flow]
(https://github.com/vaadin/beverage-starter-flow).
My entities are shown below, I tested my Repositories and entities with a Rest Controller and I can successfully do CURD operations.
Now I’m trying to tie my Document Entity to a Dialog object (just like the one used in the start flow project), and I would like to display my Document.links as a grid.
Problem is I don’t know how to attach the Grid’s dataProvider to the Documents.links variable
public class Document extends AbstractEntity {
private String description;
private Set<Links> links;
... get/set
}
public class Links extends AbstractEntity {
private String description;
... get/set
}
Then I extended the AbstractDialog like so:
public class DocumentEditorDialog extends AbstractEditorDialog<Document> {
public DocumentEditorDialog(BiConsumer<Document, Operation> saveHandler,
Consumer<Document> deleteHandler) {
super("document", saveHandler, deleteHandler);
setUpForm();
}
private void setUpForm() {
description.setPlaceholder("Description");
description.setLabel("Description");
getBinder().forField(description)
.bind(Document::getDescription,Document::setDescription);
//How to bind the Grid's data provider to this Dialog's Document entity?
linkGrid.setDataProvider(linkDataProvider);
Grid.Column<Links> descriptionColumn = linkGrid.addColumn(Links::getDescription)
.setHeader(new Label("Description"));
Grid.Column<Links> editColumn = linkGrid.addColumn(new ComponentRenderer<>(this::createLinksEditButton))
.setFlexGrow(0);
topRow = linkGrid.prependHeaderRow();
buttonsCell = topRow.join(descriptionColumn,urlColumn,editColumn);
getFormLayout().add(linkGrid);
}
...
}
My UI looks something like this:
[image]
(https://drive.google.com/open?id=1PNIeYq_W7q2Rl2W_GsMB_l4AFJ_ZyMar)