Why not set an event listener on the TextInput, and have that set the
value?

 

What have you tried?  Why didn't it work?

 

Here is an example that uses a checkbox item renderer:

http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&objectI
D=559

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of jmorpher03
Sent: Tuesday, December 12, 2006 6:41 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Unable to set ItemRenderer's value back to
DataGrid's dataProvider

 

Hi,

I have a Custom ItemRenderer, which displays a TextInput or a Label
based on another column's value in the DataGrid. 
Here's the sample for the ItemRenderer:

MyItemRenderer.mxml

<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> ">
<mx:Canvas id="myRendererCan"/> 
<mx:Script>   <![CDATA[
public var textField;
private var myLabel:Label;
private var myTextInput:TextInput;
override public function set data(value:Object):void {
 myRendererCan.removeAllChildren();
 if(value != null && value.colA == "M") {
  myLabel = new Label;
  myLabel.text = value[textField];
  myRendererCan.addChild(myLabel);
 } 
       else {
  myTextInput = new TextInput;
  myTextInput.setStyle("backgroundColor", 0xFFFF0F);
  myTextInput.text =  value[textField];
  myRendererCan.addChild(myTextInput);
       }
 
    }
 ]]>
</mx:Script>    
</mx:HBox>


In my Main.mxml , the DataGrid is as follows :
<mx:DataGrid editable="true">
 <mx:columns>
 <mx:DataGridColumn headerText="ColA" dataField="ColA" width="40"
editable="false"/>
 <mx:DataGridColumn headerText="ColB" dataField="ColB" width="60" 
 itemRenderer="MyItemRenderer"  
 editable="true"  
 rendererIsEditor="true" />   
 </mx:columns>
</mx:DataGrid>

I want to set the value which user enters in the "myTextInput" , back to
the ColB of the dataProvider.
I have tried a lot of examples, but none seem to work. Can anyone help
me with this.
I tried even by directly declaring a TextInput , rather than dynamically
adding it, 
even then it does not work.

Thanks in advance.

Regards,

Asgar.

 

 

 

Reply via email to