Can anyone share a code snippet or direct me to some discussions as to how I can add/remove forms dynamically to a central panel, based on some event.
The forms need to be created dynamically at run time based on a event. The GXT documentation does not clearly mention about this, also i couldn't get much help from the examples.
By using in the abc.html i am able to get a reference to that using RootPanel.get("foo") and add a form dynamically to that. However i feel this is not a good design and very restrictive.
I tried the following options too, but they do not work. I am probably missing out on some concepts... any help is appreciated.
Approach 1.
ContentPanel cp ... //available as a reference (design time)
addForm(....) {
FormPanel fp = new Formpanel();
......
cp.add(fp);
}
Approach 2.
ContentPanel cp = new ContentPanel(); //design time
cp.setId("xyz");
.....
addForm() {
FormPanel fp = new Formpanel();
......
RootPanel.get("xyz").add(fp);
}