Hi,

You need to calculate each cell width and assign the column width as
maximum of these as follows.

{
        // check if the ADG is enabled and the columns are resizable
        if (!enabled || !resizableColumns)
            return;


        // get the columns array
        var optimumColumns:Array = getOptimumColumns();
       var colLen:int = optimumColumns.length;
var col:AdvancedDataGrid;
for (var index:int =0; index < colLen; index++)
{
       col = optimumColumns[index];
        // check for resizable column
        if (!col.resizable)
            return;



        if(listItems)
        {
                var len:int = listItems.length;
                var maxWidth:int = 0;
                for(var i:int=0;i<len;i++)
                {
                        if(listItems[i][index] is IDropInListItemRenderer)
                        {
                                lineMetrics =
measureText(IDropInListItemRenderer(listItems[i]
[index]).listData.label);
                                if(lineMetrics.width > maxWidth)
                                        maxWidth = lineMetrics.width ;
                        }
                }
        }



        col.width = maxWidth + getStyle("paddingLeft") +
                            getStyle("paddingRight");
}

}



If you have larget sets of data, then this method will take more
time.

If anyone have better idea than this, please share.

Regards,
Raj









On Jul 1, 5:08 pm, oviya selvan <[email protected]> wrote:
> Hi Guys,
>
>     I am held up on an issue related to width adjustment of datagridColumn
> dynamically. Let me put it like this, I have a datagrid and data has been
> populated dynamically. I wanna define the width of column of DataGrid based
> on length of data(dynamic). I think that we can use itemrenderer but i am
> more concern about performance. So please shed some lights on this folks!!.
>
> Thanks in advance.
>
> --
> Regards,
> Oviyan
>
> Blog     :  http://www.oviyas.blogspot.com/
> contact :  +91 - 91762 72633

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to