views:

1746

answers:

4

Hi ,

i have a datagrid and for one of the columns im using an item renderer to display content. Im wondering is it possible to access the dataprovider content of the datagrid inside a script block in the itemRenderer.

Currently I can access the dataprovider in a component in the item renderer using data.variableName.

I want to be able do some error handling on this variable in the script block, any ideas?

+1  A: 

You can specify your own ItemRenderer component. Within the MXML of that component you can use the Script block however like.

Just specify the that component as the ItemRenderer like so:

<mx:DataGrid dataProvider="{ac}">
mx:columns>
    <mx:DataGridColumn>
     <mx:itemRenderer>
      <mx:Component>
       <local:YourRenderer /> 
      </mx:Component>
     </mx:itemRenderer>
    </mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
Buzzy
A: 

thanks,

actually what i was looking for was a way to access the properties stored in the data object in my itemRenderer inside a script block, turns out you can just call data.variableName here and it works fine , thanks anyway

combi001
A: 

The inline itemrenderer will have an outerDocument property. This refers the document that hosts the datagrid and the itemrenderer. So you can access the datagrid and hence its dataprovider.

outerDocument.myDataGrid.dataProvider
Christophe Herreman
+1  A: 

Hey I need the same thing. I want to access the dataprovider inside my custom itemrenderer(in script). How is this solved. Please help me. Thanks a lot in advance!