The following code requieres a call to initializeChart when the component is added. Why is it so? Can't it be handled on attach and/or by setting properties through Element API?
OrgChart og = new OrgChart(new OrgChartItem(1, "name", "title"));
og.initializeChart();
add(og, new Button("Toggle", ev -> {
if (getChildren().anyMatch(og::equals)) {
remove(og);
} else {
add(og);
og.initializeChart(); //(?)
}
}));
I think that is mainly because it was originally designed to work with Vaadin 8. I did a small local test and it seems to work fine by moving the initialization to an onAttach() method
The following code requieres a call to
initializeChart
when the component is added. Why is it so? Can't it be handled on attach and/or by setting properties through Element API?