This content has been marked as final.
Show 1 reply
-
1. Re: Errai UI instanciate element with Event dynamically
csa Feb 10, 2015 3:07 PM (in response to julien.guibert)Hi Julien,
There are a couple of ways to do this but simply adding the DOM element is not enough. Since you want to add widgets dynamically I would add a placeholder DIV to the template i.e. <div id="dyn"></div>, then in your @Templated class do this (following your example):
@Templated("MyWidget.html#my-widget") public class MyWidget extends Composite { ... @Inject @DataField private HorizontalPanel dyn; @PostConstruct public void init() { Button button_ko = new Button("BUTTON_KO"); button_ko.addClickHandler(new MyClickHandler()); dyn.add(button_ko); } }
Cheers,
Christian