See my comments inline --- In flexcoders@yahoogroups.com, "Rafael Faria" <[EMAIL PROTECTED]> wrote: > > I found this class > > package modules.renderers > { > import mx.core.ClassFactory; > > import org.osflash.thunderbolt.Logger; > > public class InitFactory extends ClassFactory > { > private var initObject:Object; > > public function InitFactory(generator:Class, initObject:Object) > { > super(generator); > this.initObject = initObject; > } > > public override function newInstance():* > { > var result:* = super.newInstance(); > > for(var propertyName:String in initObject) > { > try > { > result[propertyName] = initObject[propertyName]; > }catch (e:Error) > { > trace(e.message); > } > } > return result; > } > } > } > > > and i'm able to add a new class on the fly doing > > > dgc.itemRenderer = new InitFactory(TextInput, {text:'Value inside the > text input'});
You're probably better off just using dgc.itemRenderer=new ClassFactory(TextInput) > now i'm struggling to make the textinput, to get values from the > "data" variable coming from the dataProvider. You know, when inside > the itemrender you can use {data.firstname + ' ' + data.lastname} > like: <mx:TextInput text="{data.firstname + ' ' + data.lastname}" /> > > With the example i gave above, how i would do that? TextInput already implements IDropInListItemRenderer, so it can probably set the text through pfm. When you set the properties in the second argument of ClassFactory, that sets it for ALL instances of the Factory. That's what ClassFactories are for :-). IDropInListItemRenderer is the interface that lets components know how to pick up datagrid data without custom methods. HTH; Amy