This isn’t as difficult as some may think. Basically your itemRenderer opens up a popup. When the renderer creates the popup, it sets an “opener” property on the popup pointing back to “this”, which is the itemRenderer. That way, when the editing is finished in the popup, the popup can pass data back to a function in the itemRenderer to do the update, close itself, and set focus back to the itemRenderer.

Here is the code for the app:

< ?xml version="1.0" encoding="utf-8"?>
<mx:application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*" >
    <mx:array id="arr">
        <mx:object articleName="Finding out a characters Unicode character code Downloading the latest Adobe Labs version of Flex 3 SDK/Flex Builder 3 (codename: Moxie)" data="15" />
        <mx:object articleName="Setting an icon in an Alert control" data="14" />
        <mx:object articleName="Setting an icon in a Button control" data="13" />
        <mx:object articleName="Installing the latest nightly Flex 3 SDK build into Flex Builder 3" data="10" />
        <mx:object articleName="Detecting which button a user pressed to dismiss an Alert dialog" data="9" />
        <mx:object articleName="Using the Alert control Formatting data tips in a Slide" data="8" />
    </mx:array>
    <mx:arraycollection id="AC" source="{arr}" />    

    <mx:datagrid height="250" dataProvider="{AC}" variableRowHeight="true" width="60%" editable="true">
        <mx:columns>
            <mx:datagridcolumn dataField="data" headerText="ID" editable="false" width="125"/>
            <mx:datagridcolumn editable="false" wordWrap="true"
                headerText="Article Name"              
                itemRenderer="MyRenderer" dataField="articleName"/>
        </mx:columns>
    </mx:datagrid>
</mx:application>
 

Read the rest of this post»




9 Comments »