add this override method in your itemrenderer..
public override function set data(value:Object):void{
super.data = value;
if(value == null){
return;
}
this.text = value[DataGridListData(listData).dataField];
}
On Tue, Oct 19, 2010 at 04:21, Sidhu Vijay Sidhu <[email protected]>wrote:
> hi guys
> I have a advanced datagrid. and i have rendered a TextInput in datagrid
> coloumn but when i scroll the datagrid data enter in textinput is moving...
> between different rendered textInputs.......Pls help me out yaar..... I need
> to do task as soon as possible i am going to send here a sample code also...
> make sure when you guys check make datagrid scrollable here is the code. i
> have also attached the two files.. if somebdy want to import and want to run
> and see the problem... Thanks
>
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <mx:Application
> xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ren="*">
>
> <mx:ArrayCollection id="dgArr">
>
> <mx:Array>
>
> <mx:Object markAsReadOnly="" net="" comm="" commPer="" gross=""
> lastName="Tyler" firstName="Jake" />
>
> <mx:Object markAsReadOnly="" net="" comm="" commPer="" gross="" lastName="
> McCarthy" firstName="Ryan" />
>
> <mx:Object markAsReadOnly="" net="" comm="" commPer="" gross="" lastName="
> Miller" firstName="Jill" />
>
> <mx:Object markAsReadOnly="" net="" comm="" commPer="" gross="" lastName="
> Rico" firstName="John" />
>
> <mx:Object markAsReadOnly="" net="" comm="" commPer="" gross="" lastName="
> Watson" firstName="Diz" />
>
> <mx:Object markAsReadOnly="" net="" comm="" commPer="" gross="" lastName="
> Hurley" firstName="Lolo" />
>
> </mx:Array>
>
> </mx:ArrayCollection>
>
> <mx:AdvancedDataGrid id="dg" itemClick="editCell(event)" rowCount="5"
> editable="true" y="100" x="100" dataProvider="{dgArr}" width="794"
> height="147">
>
> <mx:groupedColumns>
>
> <mx:AdvancedDataGridColumnGroup headerText="Commission Calculation">
>
> <mx:AdvancedDataGridColumn editable="false" dataField="gross" headerText="
> Gross" />
>
> <mx:AdvancedDataGridColumn editable="false" dataField="commPer"
> headerText="Comm %" />
>
> <mx:AdvancedDataGridColumn editable="false" dataField="comm" headerText="
> Comm" />
>
> <mx:AdvancedDataGridColumn rendererIsEditor="true" itemRenderer="Renderer"
> dataField="net" headerText="Net" />
>
> </mx:AdvancedDataGridColumnGroup>
>
> </mx:groupedColumns>
>
> </mx:AdvancedDataGrid>
>
> <mx:Script>
>
> <![CDATA[
>
> *import* mx.events.*;
>
> *public* *function* editCell(e:ListEvent):*void*{
>
> dg.editedItemPosition={columnIndex:3,rowIndex:e.rowIndex}
>
> }
>
> ]]>
>
> </mx:Script>
>
> </mx:Application>
>
>
>
>
>
> --------Renderer-------------
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <mx:TextInput
> xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()"
>
> text="
> {text1}" restrict="0-9" borderColor="RED"
> focusOut="{*this*.text=nf.format(text)}"
> focusIn="{*this*.text=num.parseNumberString(*this*.text)}">
>
> <mx:NumberFormatter id="nf" rounding="nearest" thousandsSeparatorTo=","
> useThousandsSeparator="true"/>
>
> <mx:Script>
>
> <![CDATA[
>
> *import* mx.controls.AdvancedDataGrid;
>
> *import* mx.formatters.NumberBase;
>
> *import* mx.controls.listClasses.BaseListData;
>
> *import* mx.controls.advancedDataGridClasses.AdvancedDataGridListData;
>
> *import* mx.managers.FocusManager;
>
> *import* mx.events.*;
>
> *import* flash.events.*;
>
> *public* *var* num:NumberBase=*new* NumberBase();
>
> [
> *Inspectable*(text1=*"rue"*)]*
>
> public
> * *var* text1:String;
>
> *//public var text1:Number=2;*
>
> *public* *var* textValue:Number=898989;
>
> *var* advg:AdvancedDataGrid;
>
> *var* event1:ListEvent;
>
> *public* *function* clickHandler(e:MouseEvent):*void*{
>
> *this*.text=*""*;
>
> *this*.removeEventListener(MouseEvent.CLICK,clickHandler);
>
> }
>
> *public* *function* init():*void*{
>
> *this*.addEventListener(MouseEvent.CLICK,clickHandler);
>
> *//if(event1.rowIndex==2)
>
> // this.enabled=false;
> *
>
> *//this.text=num.parseNumberString(this.text);*
>
> }
>
> ]]>
>
> </mx:Script>
>
> </mx:TextInput>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
--
Fear is an illusion, So, face it !
RM3sh
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.