nickMiddleweek.blog.search();

Thursday, 28 October 2010

How to set the width of a flex data grid column to the item renderer width?

so we need to set the width of a data grid column to the same size of the item renderer defined for that column. we know we can't specify the width attribute of the DataGridColumn to 100% (check this: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/dataGridClasses/DataGridColumn.html) so if we turn the problem inside out and get the item renderer (IR) to work out how big it is and then set the column width in pixels from there (well we dispatch a custom event from the IR and listen for that event on the datagrid so it's all done propa!).

let's give it a whirl... we need a datagrid with at least one column and let's drop a numeric stepper control inside the columns IR and then we can use that to control the width of the IR which, can then specify the DataGridColumn.width attribute in pixels.

et voila! le source code ist here!

No comments:

Post a comment

The internet is a crazy place so please help us keep it under control by leaving only relevant messages and comments, thanks a bunch! :m)