SmartClient Version: v11.0p_2016-04-26/Pro Deployment (built 2016-04-26)
Chrome
I have a problem with a MultiComboBoxItem where the cached values from the option datasource are treated as unknown values.
When I draw a MultiComboBoxItem and the option datasource values are cached I cant select anything.
If I setAddUnknownValues to true, I can select the options but they are shown as their value instead of their display value.
I have included a test case below, please follow these steps to recreate:
datasource (test.ds.xml)
Servlet (TestServlet.java)
Chrome
I have a problem with a MultiComboBoxItem where the cached values from the option datasource are treated as unknown values.
When I draw a MultiComboBoxItem and the option datasource values are cached I cant select anything.
If I setAddUnknownValues to true, I can select the options but they are shown as their value instead of their display value.
I have included a test case below, please follow these steps to recreate:
- Click button to open window with MultiComboBoxItem
- Open the picklist so the option datasource fetches it's values.
- Close the window
- Click button to open the window again.
- Open the picklist and try to select an option.
Code:
private Layout getLayout() {
HLayout mainLayout = new HLayout();
Button b = new Button();
b.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
showWindow();
}
});
mainLayout.addMember(b);
return mainLayout;
}
private void showWindow() {
DataSource ds = DataSource.get("test");
MultiComboBoxItem comboBoxItem = new MultiComboBoxItem("comboBoxItem");
comboBoxItem.setOptionDataSource(ds);
comboBoxItem.setValueField("id");
comboBoxItem.setDisplayField("name");
DynamicForm form = new DynamicForm();
form.setFields(comboBoxItem);
Window window = new Window();
window.setWidth(400);
window.setHeight(400);
window.centerInPage();
window.addItem(form);
window.show();
}
Code:
<DataSource
ID="test"
serverConstructor="TestServlet">
<fields>
<field name="id" type="sequence" primaryKey="true" />
<field name="name" />
</fields>
</DataSource>
Code:
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.isomorphic.datasource.BasicDataSource;
import com.isomorphic.datasource.DSRequest;
import com.isomorphic.datasource.DSResponse;
public class TestServlet extends BasicDataSource {
public DSResponse executeFetch(DSRequest req) throws Exception {
List records = fetchRecords(req.getCriteria());
return new DSResponse(records);
}
private List fetchRecords (Map criteria) {
System.out.println("Fetch called!");
List<Map> list = new ArrayList<>();
Map one = new HashMap<>();
one.put("id", 1);
one.put("name", "one");
list.add(one);
Map two = new HashMap<>();
two.put("id", 2);
two.put("name", "two");
list.add(two);
Map three = new HashMap<>();
three.put("id", 3);
three.put("name", "three");
list.add(three);
return list;
}
}
Comment