R – Style Textinput Itemrenderer in Flex Datagrid

actionscript-3apache-flex

Is there a way to make the default item renderer in a Datagrid look like a text input field?

I just want to tell the user, that he can change the value of this cell.

Thx,
Martin

Best Answer

Not only can you make it look like a text input. You can use the itemRenderer property to make it a text input.

A (very crude) example:

[Bindable]

private var dataProvider:ArrayCollection = new ArrayCollection();

private function onInit() :void

{

    var obj:Object = new Object();
    obj.text = "hello editable world";
    dataProvider.addItem(obj);
}

mxml part :

<mx:DataGrid dataProvider="{dataProvider}">
<mx:columns>
    <mx:DataGridColumn dataField="text" itemRenderer="mx.controls.TextInput"/>
</mx:columns>
</mx:DataGrid>
Related Topic