The code that u have achieved here is wrong because id property is not allowed in component tag... you are using inline itemrenderers so that will not work properly and it is not a good coding standards.. u can use this in simple and applications... if ur item renderer will not going to work any thing..
if ur item renderer having some functionality create saperatate item renderer and use that component in ur datagrid then u can access the components inside the itemrenderer ..
I am posting u sample code here
create seperate item renderer as per example MyComItemRenderer.mxml
<mx:HBox width="50" horizontalAlign="center">
<mx:Button width="16" height="20"
and use this itemrenderer in the column in datagrid...
this will help u .. ..
If it is the first column, you can use the itemToItemRenderer method of the dataGrid.
var renderer:Object = dataGrid.itemToItemRenderer(dg.selectedItem); var button:Button = renderer.editButtonId as Button;
However, why do yo u want to access the button in the renderer from outside ?.
thanks for reply..
Even throughif I write as u said
How should I access the properties of button in the parent.
thanks for reply.
depending upon the permission of the user.
to make sometimes button visible or not.
It is better to do all those stuff inside the renderer itself as the renderers get recycled during different events like dataprovier change, scroll, sort, resize etc
inside the renderer you have the access to the actual data which is the row item.
to disable the Button you could do something like
if you need to apply some other logic for setting the permission, you can override the set data method
thanks for reply.
but I need to access buttonId(editButtonId) in parent, then my problem will be solved.
1 person found this helpful
In item renderers use Application.application."ur button id ''; this will get ur button id in the parent application to itemrenderer....k
I have just joined adobe forums. I have a question. I have two mxml one is which is my main application and another one is itemRenderer of List which is in my
Main application. Now i want to access button component from my main application which is inside itemRenderer.
I will be very thankful if any of you give me the solution of this problem.
Thanks in advance!