Just like in the mxml the DataGrid has a columns property that
contains an array of DataGridColumn objects. In your case you just
need to populate an array with one MyExtendedDataGridColumn instance
for each column and then set it to the columns property of the DataGrid:
var numOfColumns:int = 3;
var cols:Array = new Array(numOfColumns);
for (var i:int = 0; i < numOfColumns; i++)
{
var dc:MyExtendedDataGridColumn = new MyExtendedDataGridColumn();
...set various properties of column (headerText, width, sortable,
etc)...
cols.push(dc);
}
myDataGrid.columns = cols;
mark
--- In [email protected], "Louie Penaflor" <[EMAIL PROTECTED]> wrote:
>
> I have a custom DataGrid class and a custom DataGridColumn class.
>
>
>
> I extended DataGridColumn to have additional properties that I pass
> using listData to the itemRenderer. I have this working in the mxml
> hardcoded style
>
>
>
> <sample:MyExtendedDataGrid>
>
>
>
> <mx:columns>
>
> <sample:MyExtendedDataGridColumn
> itemRenderer="{blah}" />
>
> </mx:columns>
>
>
>
> </sample:MyExtendedDataGrid>
>
>
>
> What I'm trying to accomplish is to populate the datagrid dynamically
> and place custom DataGridColumns/itemRenderers where needed. I have it
> working, but I need to tell the Datagrid to use MyExtendedDataGridColumn
> when needed so it can pass values to the itemRenderer component.
>
>
>
> I've been trying to find examples of this in pure ActionScript and
> haven't had any luck yet. Thanks in advance.
>
>
>
>
>
>
>
> Louie Penaflor
>
> Web Software Developer
>
> World Council of Credit Unions, Inc.
>
> Ph: (608)231-7932
>
>
>
> This is a transmission from World Council of Credit Unions, Inc. and
> contains information that is confidential. If you are not the intended
> addressee or authorized to receive for the addressee, then any
> disclosure, copying, distribution, or use of the contents of this
> message is prohibited. If you have received this transmission in error,
> please destroy it and notify the sender immediately at the transmitting
> e-mail address. If you are the intended recipient, please be advised
> that this e-mail transmission is not encrypted or otherwise protected
> from potential misappropriation or misuse. World Council of Credit
> Unions, Inc. expressly disclaims any and all liability for harm
> resulting from the misappropriation, interception or misuse of the
> information contained in this transmission.
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/