Flex 3 DataGridColumn HeaderText Localization

拜拜、爱过 提交于 2020-01-05 06:17:12

问题


I'm working in a multi-language application using ResourceBundle in Flex 3. I'm displaying data in a DataGrid and defined DataGridColumn headerText like this

headerText="{localizedHeaderText('LABEL_USER_NAME')}

this function returns the localized label for the username, but when I dynamcally select another language evertying gets refreshed but the headerText labels?

Any thoughts?

Thanks


回答1:


Unless you make the localizedHeaderText method bindable, the binding will never be re-evaluated since it does not know about the change event of the resourceManager.

Assuming you are in a UIComponent subclass, you'll need to do the following:

  1. override resourcesChanged and dispatch a custom event
  2. add [Bindable(event="customEvent")] above the method

Sample code:

override protected function resourcesChanged():void {
    super.resourcesChanged();
    dispatchEvent(new Event("localeChange"));
}

and

[Bindable(event="localeChange")]
public function localizedHeaderText(key:String):String {
    return resourceManager.getString('resources', key);
}


来源:https://stackoverflow.com/questions/516843/flex-3-datagridcolumn-headertext-localization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!