[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid

2011-10-27 Thread valdhor
Even though it looks like you have an answer to your question I'd like to ask 
why you would want that?

It is always a much better practice to inject what you want into the item 
renderer instead of trying to reach back out to the original owner to get it. 
As Item Renderers are recycled this leads to major overhead, the inabilty to 
re-use the item renderer as well as tight coupling.

You may want to reconsider your use case and look at a different way of doing 
it. Telling us what you are trying to achieve may yield a best practices 
approach.

--- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@... wrote:

 I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I need
 to get access to the Datagrid from the custom itemrenderer. What's the
 best way to do this?
 
 Thanks, in advance.





[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid

2011-10-26 Thread turbo_vb
Cast the owner property to DataGrid.

-TH

--- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@... wrote:

 I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I need
 to get access to the Datagrid from the custom itemrenderer. What's the
 best way to do this?
 
 Thanks, in advance.





[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid

2011-10-26 Thread sdl1326
Thanks. I should have mentioned that I did initially that and was
getting the following error:

TypeError: Error #1034: Type Coercion failed: cannot convert
spark.components.gridClasses::GridLayer@260fac29 to
spark.components.DataGrid


--- In flexcoders@yahoogroups.com, turbo_vb TimHoff@... wrote:

 Cast the owner property to DataGrid.

 -TH

 --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
 
  I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I
need
  to get access to the Datagrid from the custom itemrenderer. What's
the
  best way to do this?
 
  Thanks, in advance.
 




[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid

2011-10-26 Thread turbo_vb
That error looks like you were trying to cast parent instead of owner.

-TH

--- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@... wrote:

 Thanks. I should have mentioned that I did initially that and was
 getting the following error:
 
 TypeError: Error #1034: Type Coercion failed: cannot convert
 spark.components.gridClasses::GridLayer@260fac29 to
 spark.components.DataGrid
 
 
 --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
 
  Cast the owner property to DataGrid.
 
  -TH
 
  --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
  
   I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I
 need
   to get access to the Datagrid from the custom itemrenderer. What's
 the
   best way to do this?
  
   Thanks, in advance.
  
 





[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid

2011-10-26 Thread sdl1326
No, I was casting owner and got that error.
i.e. - Datagrid(owner).dataprovider

--- In flexcoders@yahoogroups.com, turbo_vb TimHoff@... wrote:

 That error looks like you were trying to cast parent instead of owner.
 
 -TH
 
 --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
 
  Thanks. I should have mentioned that I did initially that and was
  getting the following error:
  
  TypeError: Error #1034: Type Coercion failed: cannot convert
  spark.components.gridClasses::GridLayer@260fac29 to
  spark.components.DataGrid
  
  
  --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
  
   Cast the owner property to DataGrid.
  
   -TH
  
   --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
   
I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I
  need
to get access to the Datagrid from the custom itemrenderer. What's
  the
best way to do this?
   
Thanks, in advance.
   
  
 





[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid

2011-10-26 Thread turbo_vb
hmm, don't know what to tell you.  The following works fine:

var myDataProvider:ArrayCollection = DataGrid( owner ).dataProvider as 
ArrayCollection;

-TH

--- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@... wrote:

 No, I was casting owner and got that error.
 i.e. - Datagrid(owner).dataprovider
 
 --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
 
  That error looks like you were trying to cast parent instead of owner.
  
  -TH
  
  --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
  
   Thanks. I should have mentioned that I did initially that and was
   getting the following error:
   
   TypeError: Error #1034: Type Coercion failed: cannot convert
   spark.components.gridClasses::GridLayer@260fac29 to
   spark.components.DataGrid
   
   
   --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
   
Cast the owner property to DataGrid.
   
-TH
   
--- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:

 I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I
   need
 to get access to the Datagrid from the custom itemrenderer. What's
   the
 best way to do this?

 Thanks, in advance.

   
  
 





[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid

2011-10-26 Thread turbo_vb
Try sticking that in override prepare() or set data(), and make sure that data 
isn't null, and I bet you that it'll work.

-TH

--- In flexcoders@yahoogroups.com, turbo_vb TimHoff@... wrote:

 hmm, don't know what to tell you.  The following works fine:
 
 var myDataProvider:ArrayCollection = DataGrid( owner ).dataProvider as 
 ArrayCollection;
 
 -TH
 
 --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
 
  No, I was casting owner and got that error.
  i.e. - Datagrid(owner).dataprovider
  
  --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
  
   That error looks like you were trying to cast parent instead of owner.
   
   -TH
   
   --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
   
Thanks. I should have mentioned that I did initially that and was
getting the following error:

TypeError: Error #1034: Type Coercion failed: cannot convert
spark.components.gridClasses::GridLayer@260fac29 to
spark.components.DataGrid


--- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:

 Cast the owner property to DataGrid.

 -TH

 --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
 
  I have a custom itemrenderer in a GridColumn of a Spark Datagrid. I
need
  to get access to the Datagrid from the custom itemrenderer. What's
the
  best way to do this?
 
  Thanks, in advance.
 

   
  
 





[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid

2011-10-26 Thread sdl1326
That worked! I put it in prepare() and was able to get a reference to the 
datagrid. 

Thanks to all for the assistance.

--- In flexcoders@yahoogroups.com, turbo_vb TimHoff@... wrote:

 Try sticking that in override prepare() or set data(), and make sure that 
 data isn't null, and I bet you that it'll work.
 
 -TH
 
 --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
 
  hmm, don't know what to tell you.  The following works fine:
  
  var myDataProvider:ArrayCollection = DataGrid( owner ).dataProvider as 
  ArrayCollection;
  
  -TH
  
  --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
  
   No, I was casting owner and got that error.
   i.e. - Datagrid(owner).dataprovider
   
   --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
   
That error looks like you were trying to cast parent instead of 
owner.

-TH

--- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:

 Thanks. I should have mentioned that I did initially that and was
 getting the following error:
 
 TypeError: Error #1034: Type Coercion failed: cannot convert
 spark.components.gridClasses::GridLayer@260fac29 to
 spark.components.DataGrid
 
 
 --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
 
  Cast the owner property to DataGrid.
 
  -TH
 
  --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
  
   I have a custom itemrenderer in a GridColumn of a Spark Datagrid. 
   I
 need
   to get access to the Datagrid from the custom itemrenderer. What's
 the
   best way to do this?
  
   Thanks, in advance.
  
 

   
  
 





[flexcoders] Re: Datagrid's Itemrenderer - Access to Datagrid

2011-10-26 Thread turbo_vb
Cool!  -TH

--- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@... wrote:

 That worked! I put it in prepare() and was able to get a reference to the 
 datagrid. 
 
 Thanks to all for the assistance.
 
 --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
 
  Try sticking that in override prepare() or set data(), and make sure that 
  data isn't null, and I bet you that it'll work.
  
  -TH
  
  --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
  
   hmm, don't know what to tell you.  The following works fine:
   
   var myDataProvider:ArrayCollection = DataGrid( owner ).dataProvider as 
   ArrayCollection;
   
   -TH
   
   --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
   
No, I was casting owner and got that error.
i.e. - Datagrid(owner).dataprovider

--- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:

 That error looks like you were trying to cast parent instead of 
 owner.
 
 -TH
 
 --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ wrote:
 
  Thanks. I should have mentioned that I did initially that and was
  getting the following error:
  
  TypeError: Error #1034: Type Coercion failed: cannot convert
  spark.components.gridClasses::GridLayer@260fac29 to
  spark.components.DataGrid
  
  
  --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
  
   Cast the owner property to DataGrid.
  
   -TH
  
   --- In flexcoders@yahoogroups.com, sdl1326 azsl1326-email@ 
   wrote:
   
I have a custom itemrenderer in a GridColumn of a Spark 
Datagrid. I
  need
to get access to the Datagrid from the custom itemrenderer. 
What's
  the
best way to do this?
   
Thanks, in advance.