Richard,
I experimented with different ways, and this works for me:
<mx:DataGridColumn headerText="Base{newline}Price ($)"
columnName="base" width="65" />
Andrew
--- In [email protected], "richardm1400" <[EMAIL PROTECTED]>
wrote:
>
> Hi All,
>
> Hopefully someone can help as there seems to be a lot of really smart
> FLEX coder out there.
>
> I want to be able to dynamically create DataGrid headers that will
> wrap, but I can not figure out the correct syntax. I tried to search
> the archived messages, but did not find a solution. If I missed it
> just point me to the message.
>
> Here is a simple code sample.
>
> Any suggestions?
>
> Thanks, Richard
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
> <mx:Panel>
>
> <mx:Script>
> <![CDATA[
>
> function getHeaders(){
> var myVal:String = "Line 1";
> var myVal2:String = "Line 2";
>
> dg.headerCells[0].value = myVal +"\n" + myVal2; //Does not
> wrap
> dg.columns[1].headerText = myVal + newline + myVal; // Does
> not wrap
>
> }
>
> ]]>
> </mx:Script>
>
> <mx:DataGrid id="dg" headerHeight="30" creationComplete="getHeaders
> ();">
> <mx:columns>
> <mx:Array>
> <mx:DataGridColumn columnName="col1" />
> <mx:DataGridColumn columnName="col2" />
> <mx:DataGridColumn headerText="Start{newline}end"
> columnName="col2" />
> </mx:Array>
> </mx:columns>
> </mx:DataGrid>
> </mx:Panel>
>
> </mx:Application>