The DataGrid only updates the dataField (status_code in your case). If
you want to update the other fields based on the value of the
status_code field, you can listen for the itemEditEnd event and update
it there.
For example:
<DataGrid id="dg" itemEditEnd="foo()" ...
function foo() {
dg.dataProvider[dg.editedItemPosition.rowIndex].status_description = "xxx";
// xxx will be based on the value of status_code
}
On 4/22/07, sid_flex <[EMAIL PROTECTED]> wrote:
>
> I have a problem with the synchronisation of a DataGrid and the
> itemRenderer, using a itemEditor is used?
>
> Here's my (simplified) case:
> I have a datagrid showing StatusVO objects.
> A statusVO consists of a status_code and a status_description.
>
> The datagrid shows the status_description while the status_code is the
> dataField. I use a ComboBox itemRenderer to select the status from a list:
> <mx:DataGrid id="dgStatus"
> dataProvider="{myStatusData}"
> editable="true">
> <mx:columns>
> <mx:DataGridColumn headerText="Status" dataField="status_code"
> itemEditor="StatusItemEditor"
> editorDataField="newStatusCode"
> labelFunction="displayStatusDescription">
> </mx:DataGridColumn>
> </mx:columns>
> </mx:DataGrid>
>
> The questionable behaviour is introduced when adding
> labelFunction="displayStatusDescription". Before adding the
> labelFunction the behavior is correct:
> 1) User clicks row
> 2) ComboBox is displayed
> 3) User selects value from ComboBox
> 4) Datagrid shows selected status_code.
>
> When adding the labelFunction, the DataGrid does no longer shows the
> status_description which was selected by the user. When debugging the
> labelFunction, I see the item property contains the original item and not
> the item the user selected.
> The labelFunction is for testing purposes defined in the same mxml document
> as the DataGrid:
> private function displayStatusDescription(item:Object,
> column:DataGridColumn):String {
> var myStatus : String =
> String(item["status_description"]);
> return myStatus;
> }
>
> Since the DataGrid shows the correct "newStatusCode" without using a
> labelFunction, I expect my itemEditor to work correct. I also expect the
> DataGrid to provide the labelFunction with the updated value.
>
>
> Is there something extra I have to do to provide the labelFunction with the
> item based on "newStatusCode" instead of the original one?
>
>
> Best regards,
> Sieto
>
>
>
>
>