To access column’s of a datagrid control. catch the column click and item of that click

Naturally we go for accessing an item in a row which we can’t tell  from which column it is accessing , so for accessing a column in DG control we have to use columnIndex property of a ListEvent.

To see this in action first call a function on itemclick with the property itemClick  and the function “itemClickEvent(event)” (itemClick=”itemClickEvent(event)”);

Now define the function with the ListEvent
private function itemClickEvent(event:ListEvent):void
{
if(event.columnIndex==0)
{
— here we can catch the click of 1st column
}
else if(event.columnIndex==1)
{
— here we can catch the click of  2nd column
}
}

now u can use datagrid.selectedItem.datafieldname   to get the item of that particular column

2 Responses to “To access column’s of a datagrid control. catch the column click and item of that click”

  1. arumugam Says:

    Dear Kumar,

    I’m the Beginner in Flex,
    The Syntax ‘To access column’s of a datagrid control. catch the column click and item of that click’ was very helpful.Thank You So Much.

  2. kumargandhi Says:

    hi arumugam,
    mention not, and do come back for other info and posts.

Leave a Reply