hi,
I am using setSortField(str) for an SelectItem, the UI looks fine, but there are always warnings:
"WARN:PickListMenu:isc_PickListMenu_0:fields and completeFields are null and there is no DataSource"
If I don't use the function setSortField(str), no any warning, can somebody help me for that?
The following is the code:
I am using setSortField(str) for an SelectItem, the UI looks fine, but there are always warnings:
"WARN:PickListMenu:isc_PickListMenu_0:fields and completeFields are null and there is no DataSource"
If I don't use the function setSortField(str), no any warning, can somebody help me for that?
The following is the code:
Code:
public void onModuleLoad() {
DataSourceField[] fields = new DataSourceField[2];
DataSource ds = new DataSource();
SelectItem comboBox = new SelectItem("f1", "F1");
DynamicForm comboBoxForm = new DynamicForm();
int recNum = 20;
fields[0] = new DataSourceField();
fields[0].setType(FieldType.TEXT);
fields[0].setPrimaryKey(true);
fields[0].setName("f1");
fields[1] = new DataSourceField();
fields[1].setType(FieldType.TEXT);
fields[1].setName("display");
ds.setID("ds");
ds.setFields(fields);
ds.setClientOnly(true);
comboBox.setPickListWidth(210);
comboBox.setOptionDataSource(ds);
comboBox.setValueField("f1");
comboBox.setDisplayField("display");
comboBox.setSortField("display");
comboBoxForm.setItems(comboBox);
Record[] records = new Record[recNum];
for(int i=0; i<recNum; i++) {
records[i] = new Record();
records[i].setAttribute("f1", "r"+i);
records[i].setAttribute("display", "display"+(recNum-i));
ds.addData(records[i]);
}
comboBoxForm.draw();
}
Comment