开发者

flex builder datagrids formatting

开发者 https://www.devze.com 2022-12-24 02:31 出处:网络
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

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! :)

0

精彩评论

暂无评论...
验证码 换一张
取 消