PDA

View Full Version : itemRenderer's width and color is not changed. why?


luoxuanhua
11-23-2007, 08:56 AM
<mx:DataGridColumn width="48" headerText="ADD" editable="false">
<mx:itemRenderer>
<mx:Component>
<mx:Button label="add" color="#0000FF" width="20" click="AddItem()">
</mx:Button>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

I have setted the color="#0000FF" width="20" ,but not changed in explorer? the width of Button is still 48, How can do?

Jim Freer
11-23-2007, 10:53 AM
Here's is one way to do it:


<mx:DataGridColumn headerText="Test">
<mx:itemRenderer>
<mx:Component>
<mx:HBox
verticalScrollPolicy="off"
horizontalScrollPolicy="off"
>
<mx:Spacer
width="100%"
/>
<mx:Button
label="Add"
color="0x0000FF"
width="50"
height="18"
/>
<mx:Spacer
width="100%"
/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>


Jim
http://freerpad.blogspot.com/

Jim Freer
11-23-2007, 12:21 PM
Simpler approach to center button:


<mx:DataGridColumn headerText="Test1" textAlign="center">
<mx:itemRenderer>
<mx:Component>
<mx:Box
horizontalAlign="center"
>
<mx:Button
label="Add"
color="0x0000FF"
width="50"
height="18"
/>
</mx:Box>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>


Jim
http://freerpad.blogspot.com/