Try this:

 

<?xml version="1.0"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="initApp()">

           

            <mx:Script> 

                        public function initApp():void {

                                    var arr: Array = new Array();

                                    arr.push({one:"abc", two: "ABC"});

                                    arr.push({one:"def", two: "DEF"});

                                    arr.push({one:"ghi", two: "GHI"});

                                    dg.dataProvider = arr;

                        }

                       

                        public function onFocusIn(event:Event):void{

                                    event.target.setStyle("borderStyle","none");

                        }

                       

                        public function onFocusOut(event:Event):void{

                                    event.target.setStyle("borderStyle","outset");

                        }

                       

            </mx:Script>

           

            <mx:Component id="inlineEditor">

        <mx:TextInput text="" focusIn="outerDocument.onFocusIn(event)" focusOut="outerDocument.onFocusOut(event)" borderStyle="none"  preinitialize="initTI();">

 

                <mx:Script>

                    <![CDATA[

                        import mx.controls.dataGridClasses.DataGridListData;

                        import flash.events.Event;

                   

                        public function initTI():void {        

                            addEventListener("dataChange", handleDataChanged);

                        }   

           

                        public function handleDataChanged(event:Event):void {        

                            // Cast listData to DataGridListData.

                            var myListData:DataGridListData = DataGridListData(listData);

                                                            text=data[myListData.dataField];

                        }  

                    ]]>

                </mx:Script>

 

        </mx:TextInput>

    </mx:Component>

 

            <mx:DataGrid 

                                    id="dg"

                                    width="100%"

                                    height="100%"

                                    editable="true"

                                    tabEnabled="true"

                                    >

                                    <mx:columns>

                                                <mx:Array>

                                                            <mx:DataGridColumn dataField="one" rendererIsEditor="true" itemRenderer="{inlineEditor}"/>

                                                            <mx:DataGridColumn dataField="two" rendererIsEditor="true" itemRenderer="{inlineEditor}"/>

                                                </mx:Array>

                                    </mx:columns>

                        </mx:DataGrid>

                       

                        <mx:ControlBar horizontalAlign="right">

                                    <mx:Button label="reset" click="initApp()"/>

                        </mx:ControlBar>

                       

</mx:Application>

 

 

 

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of B.Brey
Sent: Thursday, April 20, 2006 10:45 AM
To: [email protected]
Subject: RE: [flexcoders] Custom itemrenderer in datagrid

 

Well i need the data for the current cell. Is there any way to find out which column is the current column rendered?

 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]On Behalf Of Webdevotion
Sent: donderdag 20 april 2006 16:03
To: [email protected]
Subject: Re: [flexcoders] Custom itemrenderer in datagrid

Found something for you at Livedocs :)
It confirms my thought about using data.label, data.id, data.productImage, ...
as the correct syntax to access these properties.

Basically your data object contains the data for the whole row,
which is a good thing, since you might want to combine data from
multiple columns into one cell using a renderer.

http://livedocs.macromedia.com/labs/1/flex20beta2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001109.html



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




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to