sdc
24 Feb 2009, 6:12 AM
- GXT version : 1.2.3
- Hosted mode
- Operating System : Windows XP
- Detailed description of the problem :
I have a form panel which I want to bind to a bean. One of the bean properties is bound to a ComboBox which do not accept blank values.
When I init my form, I bind an initial bean containing null attributes. So the bind call set fields value to null. But since this call is made in a DeferredCommand, it will call ComboBox.setValue after the ComboBox is rendered. So, it will call setRawValue() and the combo box will be marked invalid.
- Sample code which simulates the use case :
public class TestComboBoxWithNullValue implements EntryPoint {
public void onModuleLoad() {
Dialog dialog = new Dialog();
dialog.setSize(600, 400);
FormPanel formPanel = new FormPanel();
final SimpleComboBox<String> comboBox = new SimpleComboBox<String>();
comboBox.setAllowBlank(false);
DeferredCommand.addCommand(new Command(){
public void execute() {
comboBox.setValue(null);
}
});
comboBox.add("First");
formPanel.add(comboBox);
dialog.add(formPanel);
dialog.show();
}
}
- Hosted mode
- Operating System : Windows XP
- Detailed description of the problem :
I have a form panel which I want to bind to a bean. One of the bean properties is bound to a ComboBox which do not accept blank values.
When I init my form, I bind an initial bean containing null attributes. So the bind call set fields value to null. But since this call is made in a DeferredCommand, it will call ComboBox.setValue after the ComboBox is rendered. So, it will call setRawValue() and the combo box will be marked invalid.
- Sample code which simulates the use case :
public class TestComboBoxWithNullValue implements EntryPoint {
public void onModuleLoad() {
Dialog dialog = new Dialog();
dialog.setSize(600, 400);
FormPanel formPanel = new FormPanel();
final SimpleComboBox<String> comboBox = new SimpleComboBox<String>();
comboBox.setAllowBlank(false);
DeferredCommand.addCommand(new Command(){
public void execute() {
comboBox.setValue(null);
}
});
comboBox.add("First");
formPanel.add(comboBox);
dialog.add(formPanel);
dialog.show();
}
}