Update:
I do not think this is something to be done with ItemRenderer or
ItemEditor. I have tracked this to the DataGrid itself. There is a
line there that says:
data[property] = newValue;
This leads to entries in the data like:
<fields>
<field1>
<text>my new value</text>
</field1>
</fields>
when the dataField="text"
OR
<fields>
<field1>
<null>my new value</null>
</field1>
</fields>
when the dataField is empty.
Text is not a property of an XML object, so there is no setter. And
setChildren does not work as a property, only a method.
How else can one get the DataGrid to save the data like:
<fields>
<field1>my new value</field1>
</fields>
--- In [email protected], Ariel Jakobovits <[EMAIL PROTECTED]>
wrote:
>
> I have this file:
>
> <fields>
> <field1>value1</field1>
> <field2>value2</field2>
> </fields>
>
> output in these columns:
>
> <mx:columns>
> <mx:DataGridColumn headerText="Field" width="100"
editable="false" labelFunction="getFieldLabel" />
> <mx:DataGridColumn headerText="Value" editable="true"
labelFunction="getValueLabel" />
> </mx:columns>
>
> with these label functions:
>
> private function getFieldLabel(data:Object,
column:DataGridColumn):String
> {
> return XML(data).localName().toString();
> }
> private function getValueLabel(data:Object,
column:DataGridColumn):String
> {
> return XML(data).text().toString();
> }
>
> Question: if I want to edit the value column, how do I set the text
() property of an XML node?
>