[flexcoders] Getting a DataGrid item renderer instance

2006-06-19 Thread flex8it
I have simple datagrid with 2 columns and 2 rows like this:

column 0   column 1
   -
image  textfield
image  textfield

Column 0 contains my ImageRenderer component.
Column 1 contains the DataGrid's default item renderer and editor: 
text, textfield.

First Problem:
How do I identify/get a reference to a particular instance of my 
ImageRenderer from, say, column[0], row[1]?

Second (related) Problem:
How do I get the ImageRender instance that corresponds to the row of 
the textfield that fires an event when edited?

I've been wrestling with this problem for days now, and I just can't 
seem to get a grasp on the communication/eventing infrastructure 
that's probably necessary to pull this off. Please help.

Thanks,
Bruce 






 Yahoo! Groups Sponsor ~-- 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





[flexcoders] Re: Getting a DataGrid item renderer instance

2006-06-19 Thread flex8it
More specifically, here's what I'm trying to change the viewState in 
my itemRenderer when the DataGrid's textfield is edited. But in 
order to do that, I need to somehow get an instance reference to my 
renderer component. And nothing I've done seems to work...

?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
xmlns:comp=components.* 
verticalAlign=top horizontalAlign=center 
layout=absolute

mx:Script
![CDATA[
import components.imgReset;
import mx.collections.ArrayCollection;
import mx.events.DataGridEvent;
import mx.controls.Alert;

[Bindable]
public var choices:ArrayCollection = choices = new 
ArrayCollection([
 {resetImage: images/reset.png, fieldName: Smalltown},
 {resetImage: images/reset.png, fieldName: Bigtown},
]);
  
private function changeRendererState(event:DataGridEvent) : void
{
// I can get the rowIndex and columnIndex for the renderer, 
// but I don't exactly how to use them to get to the 
renderer object...
Alert.show(event.rowIndex + ,  + (event.columnIndex - 1));

// I just want to get the renderer instance...
// First, there's a problem with my typecasting ??
// Second, there's no such thing as a row property on 
// the DataGrid, but I really want there to be...
var RendererInstance:imgReset = imgReset(this.myGrid.columns
[event.columnIndex-1].row[event.rowIndex].itemRenderer);

// Now I want to manipulate renderer instance 
properties/states...
RendererInstance.currentState = 'showReset';
}
]]
/mx:Script
mx:DataGrid id=myGrid 
editable=true 
dataProvider={choices} 
itemEditEnd=changeRendererState(event) 
mx:columns
mx:DataGridColumn dataField=resetImage 
headerRenderer=components.HeaderReset 
itemRenderer=components.imgReset/
mx:DataGridColumn dataField=fieldName 
editable=true width=230 
headerText=Field Name /
/mx:columns
/mx:DataGrid
 /mx:Application

I'd sure appreciate some help on this conundrum.

Many Thanks,
Bruce

--- In flexcoders@yahoogroups.com, flex8it [EMAIL PROTECTED] wrote:

 I have simple datagrid with 2 columns and 2 rows like this:
 
 column 0 column 1
  -
 imagetextfield
 imagetextfield
 
 Column 0 contains my ImageRenderer component.
 Column 1 contains the DataGrid's default item renderer and editor: 
 text, textfield.
 
 First Problem:
 How do I identify/get a reference to a particular instance of my 
 ImageRenderer from, say, column[0], row[1]?
 
 Second (related) Problem:
 How do I get the ImageRender instance that corresponds to the row 
of 
 the textfield that fires an event when edited?
 
 I've been wrestling with this problem for days now, and I just 
can't 
 seem to get a grasp on the communication/eventing infrastructure 
 that's probably necessary to pull this off. Please help.
 
 Thanks,
 Bruce








 Yahoo! Groups Sponsor ~-- 
Something is new at Yahoo! Groups.  Check out the enhanced email design.
http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/