簡體   English   中英

在dataprovider中為數據網格轉換值

[英]translate values in dataprovider for a datagrid

我有一個dataprovider,它是簡單字符串值的ArrayCollection。 我需要先翻譯這些字符串,然后再將它們呈現在我的數據網格中。 我怎樣才能做到這一點?

請注意,由於我允許進行內聯編輯來更新dataprovider源,因此我不想將其復制到具有轉換后值的新ArrayCollection中。

當前數據網格,未轉換數據提供者中的值

<mx:DataGrid width="100%" height="100%" id="contactInfoGrid"
                                 dataProvider="{model.selectedCustomer.contacts}"
                                 editable="true" itemEditEnd="contactInfoChanged(event)">
                        <mx:columns>
                            <mx:DataGridColumn width="200" dataField="type" editable="false"
                                               headerText="{resourceManager.getString('customer','customer.contactInformation.type')}"/>
                            <mx:DataGridColumn width="300" dataField="value" editable="true"
                                               headerText="{resourceManager.getString('customer','customer.contactInformation.value')}"/>
                            <mx:DataGridColumn editable="false" headerText="{resourceManager.getString('customer','general.remove')}">
                                <mx:itemRenderer>
                                    <mx:Component>
                                        <mx:VBox horizontalAlign="center">
                                            <controls:RemoveLinkButton visible="true" label=""  click="outerDocument.removeContactInfo(event)"/>
                                        </mx:VBox>
                                    </mx:Component>
                                </mx:itemRenderer>
                            </mx:DataGridColumn> 
                        </mx:columns>
                    </mx:DataGrid>

您要么需要:

  • 轉換數據提供程序本身中的值。 我不確定是否要執行此操作,因為您將更改數據源。
  • 將標簽函數添加到datagrid列,並返回每個單元格的翻譯文本

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM