I'm using the the MVP architecture (with mvp4g) and need to dynamically create some widgets in the Presenter depending on the user selection of another widget. I was able to get textfield and checkbox working, but the combo box created does not respond to mouse clicks to expand the list (trigger field not responsive). I tried adding a listener to it, but it didn't seem to do anything. I'm not sure what I'm doing wrong. I'm still pretty new to GWT/GXT, so any help is greatly appreciated!
Here's a the snippet of my code that creates the combobox:
MyGXTComboBox list = new MyGXTComboBox("Test");
list.setTriggerAction(TriggerAction.ALL);
for(String value : myValues) {
list.addItem(value);
}
list.setSelectedIndex(0);
Okay I just found that I can remove that render line, but the combo box is still not expanding.
I still have to call render for the HorizontalPanel in order for the widgets to show up tho. Maybe I'm doing something wrong?
Here's the code in the Presenter that's called inside a listener to another widget's click event:
// Dynamically create the widgets
List<MyBean> myList = curUserSelection.getListToCreate();
LayoutContainer container = view.getMyPanel(); // This layout container was created in the View at bind time
// clear the list of widgets first
container.removeAll();
myWidgetMap.clear();
if(myList != null && myList.size() != 0) {
for (MyBean bean : myList) {
HorizontalPanel hp = new HorizonatlPanel(); // need to add some text after the combo box in the same row
MyGXTComboBox list = new MyGXTComboBox(bean.getName());
list.setTriggerAction(TriggerAction.ALL);
for(String value : myValues) {
list.addItem(value);
}
list.setSelectedIndex(0);
hp.add(list);
myWidgetMap.put(bean.getName(), list);
Label label = new Label("some message");
hp.add(label);
container.add(hp);
hp.render(container.getElement()); // if I remove this, the widget will not show...
}
container.setVisible(true);
}