Hi Angelo,
If you don't set a width on the column it will default to 100.
What I think you'd need to do is create a customComponent for your item
Renderer, most likely based on an HBox with your link buttons inside that.
On the creationComplete event of the itemRenderer you could get the actual
width of the HBox, check that the itemRenderer is in row ONE of the data
grid (or it is the actual first row - see the API) and then fire out a
custom Event with the width value attribute and then set the column width
from the parent component. You might also be able to reach the DataGrid
Column from within the itemRenderer itself.
I'm saying only do this on row one, just to optimise it, otherwise it'll run
for ever row in the DG, which would hinder performance.
Hope this helps, ask if you need anymore help.
Cheers,
Nick
--
Sent by Nick Middleweek ( { email: [email protected], blog:
http://blog.middleweek.co.uk } );
On 21 May 2010 14:09, Angelo Anolin <[email protected]> wrote:
>
>
>
> Thanks for this tip.
>
> But, I came across another thing.
>
> How would I set the width of the column so that it matches the width of the
> itemrenderers inside it?
>
> Apparently, setting the width to 100% for the datagrid column is not
> allowed.
>
> Thanks.
>
> Angelo
> ------------------------------
> *From:* Christopher McArthur <[email protected]>
> *To:* [email protected]
> *Sent:* Thu, 20 May, 2010 17:14:06
> *Subject:* RE: [flexcoders] Set Width of An Item Renderer Component Based
> on Visible Property of the Control
>
>
>
> the "includeInLayout" property may also be helpful to you in this case,
> try:
>
> includeInLayout="{outerDocument. fncVisible( )}"
>
>
>
> *From:* flexcod...@yahoogro ups.com [mailto:flexcoders@ yahoogroups. com]
> *On Behalf Of *Angelo Anolin
>
> *Sent:* Thursday, May 20, 2010 2:46 PM
> *To:* flexcod...@yahoogro ups.com
>
> *Subject:* [flexcoders] Set Width of An Item Renderer Component Based on
> Visible Property of the Control
>
>
>
>
>
> Hi FlexCoders,
>
>
>
> I have declared an in-line item renderer in my datagrid:
>
>
>
> <mx:DataGridColumn headerText="Test" textAlign="center" sortable="false">
>
> <mx:itemRenderer>
>
> <mx:Component>
>
> <mx:HBox horizontalAlign="center" >
>
> <mx:LinkButton id="lnk1" label="Link 1" visible={outerDocum
> ent.fncVisible( )}" width="{???}"/>
>
> <mx:LinkButton id="lnk1" label="Link 1" />
>
> <mx:LinkButton id="lnk1" label="Link 1" />
>
> </mx:HBox>
>
> </mx:Component>
>
> </mx:itemRenderer>
>
> </mx:DataGridColumn>
>
>
>
>
>
> as you may see, I am determining the visibility of the link button via a
> function. What I want to achieve is that if the linkbutton contrl is
> invisible, the width should be 0, but if it is visible, then width should be
> 100.
>
>
>
> How do I pass in a function for the width of the control whether it's
> visibility is set to true or false?
>
>
>
> Thanks.
>
>
>
>
>
>