2 Replies Latest reply on Jun 14, 2010 5:06 AM by BhaskerChari

    when to use a itemEditor and a itemRenderer ??

    kiran7881 Level 1

      Hi ,


      Can anybody please let me know when to use itemEditor and a itemRenderer ??

      I have seen a example where the Author uses itemEditor to have a ComboBox inside a Datagrid Column as shown .

      <mx:DataGridColumn dataField="Price" editorDataField="value">
                              <mx:NumericStepper stepSize="0.01" maximum="500"/>


      And i have done a example to display an Hyperlink inside a DataGridColumn with the help of a itemRenderer .

      Similar to as shown below :


        <mx:DataGridColumn headerText="Clickable Site Link">
                              <mx:Label htmlText="&lt;u&gt;{data.link}&lt;/u&gt;" color="blue" click="newBrowserWindow(data.link)">


      So could you please tell me when to use a itemrenderer and a ItemEditor exactly ??


      Thanks in advance .

        • 1. Re: when to use a itemEditor and a itemRenderer ??

          As the name 'itemRenderer' implies, the item renderer is a component for only displaying an item in a list-like component. This (i.e item renderer) can be a simple label or something as complex as a custom component with images and all sorts of other components in it.


          Now 'itemEditor' should be used when you need to edit (for example modify a value) your item. And if I recall correctly, item editor is only shown when you select an item in a list or a cell.


          There is also a property named 'rendererIsEditor'. If you set it to 'true', editor will be shown all the time.


          However you should be aware that shince Flex 4 this is true only for mx.controls.List (and probably for other halo components). You should now use spark.components.List (and other spark components) instead which only can have item renderers and not item editors. Of cource, there are no spark equivalents for DataGrid so just follow the two guidlines I've given you above.



          • 2. Re: when to use a itemEditor and a itemRenderer ??
            BhaskerChari Level 4

            Hi Kiran,


            Check the below link, a nice walkthrough of itemEditors and itemRenderers:






            Bhasker Chari