Hi Johannes, Thanks for your reply but my question isn't really about how to put the columns into the datagrid. It's actually how to create dynamically components to put inside the columns.
See i don't want to create 4,5,6,7 different itemrenderes files so i can insert into the columns i would create them on the fly, programmatically . Does it make sense? Anyone have some idea about it?! Thanks Raf --- In flexcoders@yahoogroups.com, "Johannes Nel" <[EMAIL PROTECTED]> wrote: > > wiht the datagrid you put the datagridcolumns into an array and then set the > datagrid.columns property > > On Wed, Jul 23, 2008 at 8:47 AM, Rafael Faria <[EMAIL PROTECTED]> > wrote: > > > Is there anyway to create "components" on the fly? > > > > Let me explain what i mean. > > > > I have a datagrid that has like 5 columns. Each one of them use a > > different itemrenderer. > > > > I understand that i can create each itemrenderer on a different file > > but what if i don't want to create files? > > > > is there anyway to transform the following code in a dynamically code > > without create any files? > > > > <mx:DataGridColumn headerText="Name"> > > <mx:itemRenderer> > > <mx:Component> > > <mx:Text text="{data.lname + ', ' + data.fname}" /> > > </mx:Component> > > </mx:itemRenderer> > > </mx:DataGridColumn> > > > > ?? > > How can i do that without creating any other files? i would imagine > > something like > > > > var dgc:DataGridColumn = new DataGridColumn(); > > var mycomponent:Component = new Component(); > > var txt:Text = new Text(); > > txt.text = "Somthing here"; > > mycomponent.addChild(txt); > > > > var render:ClassFactory = new ClassFactory(mycomponent); > > dcg.itemRender = render; > > > > i know that this code doesnt work but it's just to have an idea of > > what i was thinking. > > > > Is there anyway to do that? > > > > Thanks > > Rafael > > > > > > > > > > -- > j:pn > \\no comment >