Aug 25th, 2010, 11:32 PM
Localization post processor and 'headerText'
In a DataGrid, I give a DataGridColumn and 'id' of "myColumn" and then in the "myBundle.properties" there is an entry of "myColumn_headerText=Header". Shouldn't that put "Header" in for the 'headerText' for that column auto-magically? It already works for labels, toolTips etc. in other components but 'headerText' does not appear to work eventhough the documentation says it is in the "default" list of property names looked for by the "...LocalizationStageProcessor".
Aug 27th, 2010, 02:13 AM
datagridcolumn not uicomponent
yep, the datagrid column headers are a bit of an exception. They are not a regular UIComponent that gets added to the stage, so there won't be an ADDED_TO_STAGE event and hence the stageprocessor won't pick it up.
This is simply a nasty exception to the rule, I'm not sure yet how to solve this, for now you'll have to inject the text manually through the resourceManager I'm afraid.
Aug 27th, 2010, 09:37 AM
Ok, that's what I thought. I did injected localization on another project myself the same way, I had to add some code to an overridden LocalizedDataGrid to get the 'headerText' at the right time there.
Aug 27th, 2010, 11:12 AM
when I find the time I'll see if I can add some kind of exception to the localization prcoessor that'll check if a datagrid is added to the stage, and if so, will check its columns and inject them accordingly.
If you have any suggestions on how to implement this, then any help will be greatly appreciated.
Aug 27th, 2010, 04:33 PM
I'll piddle with this weekend and try to remember what I did. It was another company I don't have that code anymore. Unfortunately, I seem to remember that the column "id" field proved to be problematic when columns were adding so I had to do something more hacky. I'll let you know if I discover anything good.
Aug 28th, 2010, 03:11 AM
thanks a lot for taking the time Todd, its greatly appreciated!
Aug 30th, 2010, 06:58 AM
Yes, now I remember. In Flex, it allows you to assign an 'id' to the columns but "DataGridColumn" objects don't actually have an 'id' property so it bombs. I ended up putting and id-like value in the header text for the columns and replaced the headerText with the value for the localizaiton file. Not very elegant but without knowing a unique identifier for the DataGridColumn, I didn't know another way.
<mxataGridColumn headerText="nameColumn"... />
But you only get one chance to localize it. After that you lose the "key". I'll give it some more thought. If you can think of some "tag" that can be put on the column, lemme know.