[flexcoders] Re: help with datagrid cell custom itemrenderer

2009-02-16 Thread Amy
--- In flexcoders@yahoogroups.com, "sbeausol"  wrote:
>
> Hi-
> 
> I've been able to implement a custom Text Color Item Renderer for a
> datagrid based off of this post Custom item renderer
> 
 tml>  .  I've added 2 classes, a ComputedStylesColumn and
> ComputedStylesRenderer and I can successfully implement this in the 
mxml
> file, but I was hoping to build my datagrids dynamically with
> actionscript.
> 
> the mxml that works:
>  paddingBottom="0" verticalAlign="middle" >
> 
> 
> 
>stylesFunction="computeStyles"
> itemRenderer="ComputedStylesRenderer" />
> 
> 
> 
> I've been able to reconstruct most things in actionscript except 
for the
> itemRenderer="ComputedStylesRenderer".
> 
> when I try this:
> var custColumn1:ComputedStylesColumn = new ComputedStylesColumn();
> custColumn1.dataField = "price";
> custColumn1.headerText = "Price";
> custColumn1.width = 75;
> custColumn1.stylesFunction = computeStyles;
> 
> Everything works except:
> 
> custColumn1.itemRenderer = ComputedStylesRenderer();
> "Implicit coercion of a value of type ComputedStylesRenderer to an
> unrelated type mx.core:IFactory"

Have you considered just using this:
http://flexdiary.blogspot.com/2008/09/extended-datagrid-with-
stylefunction.html

It's what it's for...




[flexcoders] Re: help with datagrid cell custom itemrenderer

2009-02-15 Thread valdhor
dataGridColumn.itemRenderer = new ClassFactory(customItemRanderer); 

In your case:

custColumn1.itemRenderer = new ClassFactory(ComputedStylesRenderer);


--- In flexcoders@yahoogroups.com, "sbeausol"  wrote:
>
> Hi-
> 
> I've been able to implement a custom Text Color Item Renderer for a
> datagrid based off of this post Custom item renderer
>
 tml>  .  I've added 2 classes, a ComputedStylesColumn and
> ComputedStylesRenderer and I can successfully implement this in the mxml
> file, but I was hoping to build my datagrids dynamically with
> actionscript.
> 
> the mxml that works:
>  paddingBottom="0" verticalAlign="middle" >
> 
> 
> 
>stylesFunction="computeStyles"
> itemRenderer="ComputedStylesRenderer" />
> 
> 
> 
> I've been able to reconstruct most things in actionscript except for the
> itemRenderer="ComputedStylesRenderer".
> 
> when I try this:
> var custColumn1:ComputedStylesColumn = new ComputedStylesColumn();
> custColumn1.dataField = "price";
> custColumn1.headerText = "Price";
> custColumn1.width = 75;
> custColumn1.stylesFunction = computeStyles;
> 
> Everything works except:
> 
> custColumn1.itemRenderer = ComputedStylesRenderer();
> "Implicit coercion of a value of type ComputedStylesRenderer to an
> unrelated type mx.core:IFactory"
>