Hey,
at least one of those methods doesn't seem to work as expected.
SmartClient Version: v12.0p_2018-08-22/LGPL Development Only (built 2018-08-22)
With the code below
at least one of those methods doesn't seem to work as expected.
SmartClient Version: v12.0p_2018-08-22/LGPL Development Only (built 2018-08-22)
With the code below
| Activity | Result | Expected result |
| Click "Select Item" button | Nothing visible | You should see "name2" in the combo |
| Click "Print selected" button | Now "name2" is visible in the combo. Null is printed to the console as selected record. |
The selected record should have been printed to the console, not null. |
| Click "Print selected" button again | Null is printed again to the console as selected record. | The selected record should have been printed to the console, not null. |
| Click "Print selected" button again | The selected record is printed to the console | Yay, it happened finally! |
Code:
public void onModuleLoad() {
MockDataSource ds = new MockDataSource();
Record r1 = new Record();
r1.setAttribute("name", "name1");
r1.setAttribute("id", "1");
Record r2 = new Record();
r2.setAttribute("name", "name2");
r2.setAttribute("id", "2");
ds.setMockData(r1, r2);
ComboBoxItem combo = new ComboBoxItem();
combo.setTitle("Select Item");
combo.setOptionDataSource(ds);
combo.setDisplayField("name");
combo.setValueField("id");
DynamicForm form = new DynamicForm();
form.setFields(combo);
Button printButton = new Button("Print selected");
printButton.addClickHandler(e -> GWT.log("Selected: " + combo.getSelectedRecord()));
Button selectButton = new Button("Select item");
printButton.addClickHandler(e -> combo.setValue("2"));
VLayout canvas = new VLayout();
canvas.addMember(form);
canvas.addMember(selectButton);
canvas.addMember(printButton);
canvas.draw();
}
Comment