Hello,
First I want to say thanks for your help with the other ComboBoxItem bug that I have reported.
I have found another bug in this component, now related with the method clearValue.
Here is the test case:
How to reproduce the bug:
1 - Type something on the ComboBoxItem
2 - Press the TAB key
3 - Click on the Clear button
When you do the steps above, you should see the value you typed on the ComboBoxItem after the DynamicForm being cleaned.
I did some debuging on the SmartClient and have found that the issue is related to the handleKeyPress method, on this point:
Maybe if you change the condition to something like this:
I found this bug on:
SmartClient Version: v9.1p_2014-04-03/LGPL Development Only (built 2014-04-03)
First I want to say thanks for your help with the other ComboBoxItem bug that I have reported.
I have found another bug in this component, now related with the method clearValue.
Here is the test case:
Code:
package com.smartgwttest.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.RepeatingCommand;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.DSOperationType;
import com.smartgwt.client.types.DSProtocol;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.layout.VLayout;
public class Entry implements EntryPoint {
private VLayout contentPanel;
private DynamicForm dynamicForm;
private ComboBoxItem comboBoxItem;
private IButton clearButton;
@Override
public void onModuleLoad() {
getContentPanel().draw();
}
private VLayout getContentPanel() {
if (contentPanel == null) {
contentPanel = new VLayout();
contentPanel.setHeight100();
contentPanel.setWidth100();
contentPanel.addMembers(getDynamicForm(), getTestButton());
}
return contentPanel;
}
public IButton getTestButton() {
if (clearButton == null) {
clearButton = new IButton("Clear");
clearButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
getDynamicForm().clearValues();
}
});
}
return clearButton;
}
public DynamicForm getDynamicForm() {
if (dynamicForm == null) {
dynamicForm = new DynamicForm();
dynamicForm.setItems(getComboBoxItem());
}
return this.dynamicForm;
}
public ComboBoxItem getComboBoxItem() {
if (comboBoxItem == null) {
comboBoxItem = new ComboBoxItem("test", "Test");
comboBoxItem.setAddUnknownValues(false);
comboBoxItem.setValueField("id");
comboBoxItem.setDisplayField("name");
comboBoxItem.setOptionDataSource(new TestDataSource());
}
return this.comboBoxItem;
}
public static class TestDataSource extends DataSource {
private static final String ID = "TEST_DATASOURCE";
public TestDataSource() {
setID(ID);
setDataProtocol(DSProtocol.CLIENTCUSTOM);
}
@Override
protected Object transformRequest(final DSRequest dsRequest) {
if (dsRequest.getOperationType() == DSOperationType.FETCH) {
// Simulates a roundtrip to server
Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
@Override
public boolean execute() {
DSResponse dsResponse = new DSResponse(ID, DSOperationType.FETCH);
processResponse(dsRequest.getRequestId(), dsResponse);
return false;
}
}, 1000);
}
return dsRequest.getData();
}
}
}
1 - Type something on the ComboBoxItem
2 - Press the TAB key
3 - Click on the Clear button
When you do the steps above, you should see the value you typed on the ComboBoxItem after the DynamicForm being cleaned.
I did some debuging on the SmartClient and have found that the issue is related to the handleKeyPress method, on this point:
Code:
if (!this.addUnknownValues) this._markPending();
Code:
if (!this.addUnknownValues && keyName != _$Tab) this._markPending();
SmartClient Version: v9.1p_2014-04-03/LGPL Development Only (built 2014-04-03)