Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 270313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:58:49+00:00 2026-05-11T23:58:49+00:00

I have a DataGrid component that displays a few columns of data. It has

  • 0

I have a DataGrid component that displays a few columns of data. It has one additional column that displays a Button that allows the user to take an action with regard to the record.

<mx:DataGrid dataProvider="{myData}">
    <mx:columns>
        <mx:DataGridColumn dataField="firstName" headerText="First Name" 
            width="75" />

        <mx:DataGridColumn dataField="LastName" headerText=" Last Name" 
            width="150" />

        <mx:DataGridColumn dataField="phone" headerText="Phone" 
            width="120" />

        <mx:DataGridColumn headerText="" width="110">
            <mx:itemRenderer>
                <mx:Component>
                    <mx:Box horizontalAlign="center" width="100%">
                        <mx:Button label="Take Action" />
                    </mx:Box>
                </mx:Component>
            </mx:itemRenderer>
        </mx:DataGridColumn>
    </mx:columns>
</mx:DataGrid>

I need to perform an action in the parent component, using other data that is available there, but unrelated to the data in the DataGrid.

What is the best way to catch the Button click in the parent component, and know what record it corresponds to?

Should I use a Custom Event, or an itemEditor, or something else completely?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T23:58:50+00:00Added an answer on May 11, 2026 at 11:58 pm

    Thanks Joel. Here’s the final solution I came up with after reading that article (which I’ve read before). I want to add the item whose Button was clicked to an Array which is a property of another item, so I pass the “other item” into the DataGrid Component as a property, and perform actions against it in the function call from the itemRenderer:

    /* CustomDataGrid.mxml */
    <mx:DataGrid xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Script>
            <![CDATA[
                public var otherData:Object;
    
                public function takeAction(item:Object):void
                {
                    otherData["children"][0] = item;
                }
            ]]>
        </mx:Script>
    
        <mx:columns>
            <mx:DataGridColumn dataField="firstName" headerText="First Name" 
                width="75" />
    
            <mx:DataGridColumn dataField="LastName" headerText=" Last Name" 
                width="150" />
    
            <mx:DataGridColumn dataField="phone" headerText="Phone" 
                width="120" />
    
            <mx:DataGridColumn headerText="" width="110" 
                itemRender="ActionButtonItemRenderer" />
        </mx:columns>
    </mx:DataGrid>
    
    /* ActionButtonItemRenderer.as */
    package
    {
        import flash.events.MouseEvent;
    
        import mx.controls.Button;
    
        public class ActionButtonItemRenderer extends Button
        {
            public function ActionButtonItemRenderer()
            {
                super();
    
                label = "Take Action";
            }
    
            override protected function clickHandler(event:MouseEvent):void
            {
                super.clickHandler(event);
    
                var owner:CustomDataGrid = listData.owner as CustomDataGrid;
    
                owner.takeAction(data);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datagrid column that I am using an itemRenderer. Something like this
I have a datagrid with a single column rendered with another datagrid. I'm doing
I have a Datagrid in Flex. I need to add a radio button in
I have a datagrid in Flex 4 with a NumericStepper as editor for a
I use primefaces with facelets and i have a quastion: for example i have
I am making a SQL script editor / executor component for my application, very
I would like to use a combobox as the itemEditor for one of the
Is there any way how to override DataGrid s header line ? Or at
Where to start? Question is about two different ways to achieve the same thing,
My page consists of several areas which are created by iterating over a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.