Hi,
I found one trouble in new 2.2 SmartGWT version. The problem is: getSelectRecord() always return first selected record. This is testcase (using GwtRpcDataSource as datasource).
Thanks.
I found one trouble in new 2.2 SmartGWT version. The problem is: getSelectRecord() always return first selected record. This is testcase (using GwtRpcDataSource as datasource).
Code:
package com.mycompany.client;
import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.layout.VLayout;
public class TestCase implements EntryPoint {
public void onModuleLoad() {
VLayout main = new VLayout();
DynamicForm f = new DynamicForm();
final ComboBoxItem editor = new ComboBoxItem();
editor.setAutoFetchData(true);
editor.setOptionDataSource(new TestDataSource());
editor.setValueField("name");
editor.setDisplayField("name"); editor.setCriteriaField("name");
editor.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
SC.warn(((ComboBoxItem) event.getItem()).getSelectedRecord().getAttribute("name"));
};
});
f.setFields(editor);
main.addMember(f);
main.setWidth100();
main.setHeight100();
main.draw();
}
}
Comment