Hi,
I've having a problem accessing the value of a ComboBoxItem in a grid cell while editing. It doesn't seem to get updated. The KeyUp event gets fired OK, it's just the value is always set to 'null'.
I've got a test case below with an example of the value working in a form, and not working in the grid:
	Is it something to do with the lack of a DynamicForm in the grid? Is there any way I can access the value of the combobox in the grid?
I'd really appreciate any help you can give me on this.
Thanks,
Alan
					I've having a problem accessing the value of a ComboBoxItem in a grid cell while editing. It doesn't seem to get updated. The KeyUp event gets fired OK, it's just the value is always set to 'null'.
I've got a test case below with an example of the value working in a form, and not working in the grid:
Code:
	
	import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.types.ListGridEditEvent;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.form.fields.events.KeyUpEvent;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.Label;
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.form.fields.events.KeyUpHandler;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
public class Test2 implements EntryPoint {
    Label label;
    public Test2() {
    }
    public void onModuleLoad() {
        VLayout v = new VLayout();
        v.setWidth100();
        v.setHeight100();
        label = new Label();
        label.setContents("");
        label.setBorder("1px dashed black");
        v.addMember(label);
        v.addMember(thisWorks());
        v.addMember(thisDoesntWork());
        v.draw();
    }
    public DynamicForm thisWorks()
    {
        final ComboBoxItem c = new ComboBoxItem("combobox1", "This works");
        c.setShowPickerIcon(false);
        c.setShowPickListOnKeypress(true);
        c.addKeyUpHandler(new KeyUpHandler() {
            public void onKeyUp(KeyUpEvent event) {
                    label.setContents("Value: '" + c.getValueAsString() + "'");
            }
        });
        DynamicForm f = new DynamicForm();
        f.setFields(c);
        return f;
    }
    private VLayout thisDoesntWork()
    {
        final ListGrid grid = new ListGrid();
        grid.setWidth(600);
        grid.setHeight(200);
        grid.setAlternateRecordStyles(true);
        grid.setShowAllRecords(true);
        grid.setShowHeaderContextMenu(false);
        grid.setID("abcd");
        grid.setShowRollOver(false);
        grid.setSelectionType(SelectionStyle.NONE);
        grid.setCanEdit(true);
        grid.setEditByCell(true);
        grid.setEditEvent(ListGridEditEvent.CLICK);
        ListGridField textField = new ListGridField("TEXT", "This doesn't work");
        textField.setWidth("*");
        textField.setType(ListGridFieldType.TEXT);
        final ComboBoxItem c = new ComboBoxItem();
        c.setShowPickerIcon(false);
        c.setShowPickListOnKeypress(true);
        c.addKeyUpHandler(new KeyUpHandler() {
            public void onKeyUp(KeyUpEvent event) {
                    label.setContents("Value: '" + c.getValueAsString() + "'");
            }
        });
        textField.setEditorType(c);
        grid.setFields(textField);
        Button button = new Button("Add row");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                grid.startEditingNew();
            }
        });
        VLayout v = new VLayout();
        v.addMember(grid);
        v.addMember(button);
        return v;
    }
}
I'd really appreciate any help you can give me on this.
Thanks,
Alan

Comment