开发者

Change the margins inside cells of a DataGrid (Flex)

开发者 https://www.devze.com 2023-01-25 06:32 出处:网络
I am using the following code to insert a DataGrid object into a basic Panel: <mx:DataGrid borderThickness=\"0\"

I am using the following code to insert a DataGrid object into a basic Panel:

<mx:DataGrid borderThickness="0"
   height="120" dataProvider="{collection}"
   rowHeight="12" fontSize="9"
   showHeaders="false" verticalGridLines="false">
     <mx:columns>
         <mx:DataGridColumn dataField="field1" headerText="Field 1"/>
         <mx:DataGridColumn dataField="field2" headerText="Field 2"/>
     </mx:columns>
</mx:DataGrid>

My point for setting both rowHeight and fontSize properties is that I need the DataGrid to be compact, with very little space between each row. But with this code I end up with most of the text "truncated": only the upper part of the symbols appears on each开发者_Python百科 row, and the rest is cut by some empty space. This I guess is due to the default margins inside DataGrid cells, that take priority over the text itself when displaying. Is there a way to fix this problem? And is there any reason why Adobe did not let the margin property be set? Thanks for your help.


I would suggest you make a custom item renderer based on mx:label ( if the case for you is text only ) and then set the styles you need. Eg. paddingTop/ left/right/bottom. You can read about ItemRenderers here: Using an item renderer with an MX DataGrid control

0

精彩评论

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