is there a way to control the text positioning in the datagr开发者_运维问答id cells in Flex so that all text in subsequent columns align on the same rows?
Try an itemRenderer like this
<mx:HBox width="100%" height="100%" vertical-align="middle">
<mx:Label text="{data.text}"/>
</mx:HBox>
Your text will line up on the same baseline assuming it's all the same point size. Note that all columns will have to use the same itemRenderer, or one like it. I use that pattern a lot even for images, progress bars, etc.
Use one of these Label styles. These should work for most things:
textAlign="left|right|center"
textDecoration="none|underline"
textIndent="0"
Here is an example of its use an DataGridColumn's itemRenderer:
<mx:DataGrid>
<mx:columns>
<mx:DataGridColumn>
<mx:itemRenderer>
<mx:Component>
<mx:Label width="100%" height="100%" textAlign="center"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGridColumn>
Let me know if that helped! :)
精彩评论