Flex DataGrid with ComboBox itemRenderer

Posted by Jamie Love on Stack Overflow See other posts from Stack Overflow or by Jamie Love
Published on 2009-09-11T02:43:32Z Indexed on 2010/04/28 15:23 UTC
Read the original article Hit count: 779

Filed under:
|
|

Hi there,

I'm going spare trying to figure out the "correct" way to embed a ComboBox inside a Flex (3.4) DataGrid. By Rights (e.g. according to this page http://blog.flexmonkeypatches.com/2008/02/18/simple-datagrid-combobox-as-item-editor-example/) it should be easy, but I can't for the life of me make this work.

The difference I have to the example linked above is that my display value (what the user sees) is different to the id value I want to select on and store in my data provider.

So what I have is:

<mx:DataGridColumn headerText="Type" width="200" dataField="TransactionTypeID" editorDataField="value" textAlign="center" editable="true" rendererIsEditor="true">
    <mx:itemRenderer>
        <mx:Component>
            <mx:ComboBox dataProvider="{parentDocument.transactionTypesData}"/>
        </mx:Component>
    </mx:itemRenderer>
</mx:DataGridColumn>

Where transactionTypesData has both 'data' and 'label' fields (as per what the ComboBox - why on earth it doesn't provide both a labelField and idField I'll never know).

Anyway, the above MXML code doesn't work in two ways:

  1. The combo box does not show up with any selected item.
  2. After selecting an item, it does not store back that selected item to the datastore.

So, has anyone got a similar situation working?

© Stack Overflow or respective owner

Related posts about flex3

Related posts about datagrid