smartgwt version 12
browser : chrome
I have a listgrid which has inline editing capability. I added 3 combobox item for three fields (A, B,C). I am trying to achieve dynamic datasource setting for those three combobox item based on the other field (D).
I have added sample code ::
ListGrid listgrid = new ListGrid();
listgrid.setDataSource("data");
listgrid.setAutoFetchData(true);
ListGridField A = new ListGridField("a", "A");
ComboBoxItem aItem = new ComboBoxItem("a", "A");
aItem.setOptionDataSource("emptyDS");
aItem.setAutoFetchData(true);
aItem.setValueField("key");
aItem.setDisplayField("value");
A.setEditorProerties(aItem);
ListGridField B = new ListGridField("b", "B");
ComboBoxItem bItem = new ComboBoxItem("b", "B");
bItem.setOptionDataSource("emptyDS");
bItem.setAutoFetchData(true);
bItem.setValueField("key");
bItem.setDisplayField("value");
B.setEditorProerties(bItem);
ListGridField C = new ListGridField("c", "C");
ComboBoxItem cItem = new ComboBoxItem("c", "C");
cItem.setOptionDataSource("emptyDS");
cItem.setAutoFetchData(true);
cItem.setValueField("key");
cItem.setDisplayField("value");
C.setEditorProerties(cItem);
ListGridField D = new ListGridField("d", "D");
listgrid.setFields(A, B, C, D);
I am setting DataSources to those comboBox items when user double click the record.
listgrid.addRecordDoubleClickHandler(new RecordDoubleClickHandler() {
public void onRecordDoubleClick(RecordDoubleClickEvent event) {
datasource.getInstanc().validateData(event.getRecord(), new DSCallback() {
public void execute(DSResponce response, Object o, DSRequest request ) {
aItem.setOptionDataSource(response.getData[0].getAttribute("a"));
bItem.setOptionDataSource(response.getData[0].getAttribute("b"));
cItem.setOptionDataSource(response.getData[0].getAttribute("c"));
}
});
}
});
But the problem is all three combobox is getting same datasource. eventhough i set different datasource.
What I m doing wrong here ??
browser : chrome
I have a listgrid which has inline editing capability. I added 3 combobox item for three fields (A, B,C). I am trying to achieve dynamic datasource setting for those three combobox item based on the other field (D).
I have added sample code ::
ListGrid listgrid = new ListGrid();
listgrid.setDataSource("data");
listgrid.setAutoFetchData(true);
ListGridField A = new ListGridField("a", "A");
ComboBoxItem aItem = new ComboBoxItem("a", "A");
aItem.setOptionDataSource("emptyDS");
aItem.setAutoFetchData(true);
aItem.setValueField("key");
aItem.setDisplayField("value");
A.setEditorProerties(aItem);
ListGridField B = new ListGridField("b", "B");
ComboBoxItem bItem = new ComboBoxItem("b", "B");
bItem.setOptionDataSource("emptyDS");
bItem.setAutoFetchData(true);
bItem.setValueField("key");
bItem.setDisplayField("value");
B.setEditorProerties(bItem);
ListGridField C = new ListGridField("c", "C");
ComboBoxItem cItem = new ComboBoxItem("c", "C");
cItem.setOptionDataSource("emptyDS");
cItem.setAutoFetchData(true);
cItem.setValueField("key");
cItem.setDisplayField("value");
C.setEditorProerties(cItem);
ListGridField D = new ListGridField("d", "D");
listgrid.setFields(A, B, C, D);
I am setting DataSources to those comboBox items when user double click the record.
listgrid.addRecordDoubleClickHandler(new RecordDoubleClickHandler() {
public void onRecordDoubleClick(RecordDoubleClickEvent event) {
datasource.getInstanc().validateData(event.getRecord(), new DSCallback() {
public void execute(DSResponce response, Object o, DSRequest request ) {
aItem.setOptionDataSource(response.getData[0].getAttribute("a"));
bItem.setOptionDataSource(response.getData[0].getAttribute("b"));
cItem.setOptionDataSource(response.getData[0].getAttribute("c"));
}
});
}
});
But the problem is all three combobox is getting same datasource. eventhough i set different datasource.
What I m doing wrong here ??
Comment