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 from which we can’t tell  which column it is being accessed, 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

Advertisements

3 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.

  3. Benny says:

    Hi.
    your tip was very useful for me.
    thanks a lot.

    benny

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: