there is one more example with me,, which uses itemrenderer concept.
its great to work with,,
its nothing but a custom component class, which is said to be itemrenderer in tree concept.
in this program my datagrid uses itemrenderer component to acess the list data,
Item renderers do not impose restrictions on the types of Flex components that you can use in them. For example, you can use controls, such as the Label, LinkButton, Button, and Text controls to display data, but these controls do not let the user modify the contents of the control.
Or, you can use controls such as the CheckBox, ComboBox, and TextInput controls that both display data and let users interact with the control to modify or change it. For example, you could use a CheckBox control to display a selected (true value) or unselected (false value) cell in a DataGrid control.
When the user selects the cell of the DataGrid control that contains the CheckBox control, the user can interact with the control to change its state. To the user, it appears that the DataGrid control is editable.
However, an item renderer by default is not connected to the editing mechanism of the list control; it does not propagate changes to the list control's data provider, nor does it dispatch an event when the user modifies the cell. Although the list control appears to the user to be editable, it really is not.
main.mxml
---------------
[Bindable]
public var initDG:Array = [
{Contact: 'Rajesh', Company: 'Oinam',
Phone: '101', Project: 'Flex'},
{Contact: 'Mujesh', Company: 'Oinam',
Phone: '102', Project: 'Flex'},
{Contact: 'Ashok', Company: 'Oinam',
Phone: '103', Project: 'Flex'},
{Contact: 'Bose', Company: 'Oinam',
Phone: '104', Project: 'Flex'},
{Contact: 'Suraj', Company: 'Oinam',
Phone: '105', Project: 'Photoshop'} ];
]]>
variableRowHeight="true" width="464">
itemRenderer="RendererDGListData"/>
itemRenderer="RendererDGListData"/>
itemRenderer="RendererDGListData"/>
itemRenderer="RendererDGListData"/>
------------------------------
RendererDGListData.mxml
----------------------------------------
preinitialize ="init();">
import mx.controls.dataGridClasses.DataGridListData;
import flash.events.Event;
public function init():void
{
addEventListener("dataChange", handleDataChanged);
}
public function handleDataChanged(event:Event):void
{
// putting listData in datagrid
var myListDataataGridListData = DataGridListData(listData);
// Access data passed to the item renderer.
text="row : " + String(myListData.rowIndex) +
" column : " + String(myListData.columnIndex);
}
]]>
------------------------