apache-flexdatagriditemeditor

Using a ComboBox as ItemEditor in Flex 4


I have a simple DataGrid with data. Of one of the columns, I want to use a ComboBox to edit the field, instead of the standard edit box.

How do I do that? I have tried all kind of things I found on the internet, but they all fail in simply updating the value. I'd say it shouldn't be too hard to do this.


Solution

  • I figured it out. I just wanted a simple drop down box, instead of a text-editing field.

    The following code does want I want:

            <mx:DataGridColumn dataField="type" headerText="Type" editorDataField="value">
                <mx:itemEditor>
                    <fx:Component>
                        <mx:ComboBox>
                            <mx:dataProvider>
                                <fx:String>Gauge</fx:String>
                                <fx:String>Graph</fx:String>
                                <fx:String>Indicator</fx:String>
                            </mx:dataProvider>
                        </mx:ComboBox>
                    </fx:Component>
                </mx:itemEditor>
            </mx:DataGridColumn>