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

  • Home
  • SEARCH
  • 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 508373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:54:02+00:00 2026-05-13T06:54:02+00:00

<mx:DataGrid id=dg dataProvider={cNumbersList}> <mx:columns> <mx:DataGridColumn dataField=contactName headerText=Name width=50/> <mx:DataGridColumn dataField=contactNo headerText=ContactNo width=40/> <mx:DataGridColumn headerText=Select

  • 0
<mx:DataGrid id="dg" dataProvider="{cNumbersList}">
    <mx:columns>
        <mx:DataGridColumn dataField="contactName" headerText="Name" width="50"/>
        <mx:DataGridColumn dataField="contactNo" headerText="ContactNo" width="40"/>
        <mx:DataGridColumn  headerText="Select Contact Number" width="20">
            <mx:itemRenderer>
                <mx:Component>enter code here
                    <mx:CheckBox selected="false" />            
                </mx:Component>                        
            </mx:itemRenderer>                     
        </mx:DataGridColumn>                       
    </mx:columns>
</mx:DataGrid>  

How to get all checked items into one more new array ?Plz help me anyone

  • 1 1 Answer
  • 0 Views
  • 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-13T06:54:02+00:00Added an answer on May 13, 2026 at 6:54 am

    We wanted to have a checkbox in a datagrid that allowed multiple selections. We extended the DataGrid object:

    package obj
    {
    import mx.controls.DataGrid;
    import flash.display.Sprite;
    import flash.events.KeyboardEvent;
    import mx.controls.CheckBox;
    import mx.controls.listClasses.IListItemRenderer;
    
    public class CheckboxDataGrid extends DataGrid
    {
    
        override protected function selectItem(item:IListItemRenderer,
                                  shiftKey:Boolean, ctrlKey:Boolean,
                                  transition:Boolean = true):Boolean
        {
            // only run selection code if a checkbox was hit and always
            // pretend we're using ctrl selection
            if (item is CheckBox)
                return super.selectItem(item, false, true, transition);
            return false;
        }
    
        // turn off selection indicator
        override protected function drawSelectionIndicator(
                                    indicator:Sprite, x:Number, y:Number,
                                    width:Number, height:Number, color:uint,
                                    itemRenderer:IListItemRenderer):void
        {
        }
    
        // whenever we draw the renderer, make sure we re-eval the checked state
        override protected function drawItem(item:IListItemRenderer,
                                    selected:Boolean = false,
                                    highlighted:Boolean = false,
                                    caret:Boolean = false,
                                    transition:Boolean = false):void
        {
            CheckBox(item).invalidateProperties();
            super.drawItem(item, selected, highlighted, caret, transition);
        }
    
        // fake all keyboard interaction as if it had the ctrl key down
        override protected function keyDownHandler(event:KeyboardEvent):void
        {
            // this is technically illegal, but works
            event.ctrlKey = true;
            event.shiftKey = false;
            super.keyDownHandler(event);
        }
    
    }
    }
    

    We also created a CheckboxRenderer:

    package obj
    {
    import flash.display.DisplayObject;
    import flash.events.KeyboardEvent;
    import flash.events.MouseEvent;
    import flash.text.TextField
    import mx.controls.CheckBox;
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.listClasses.ListBase
    
    public class CheckBoxRenderer extends CheckBox
    {
        public function CheckBoxRenderer()
        {
            focusEnabled = false;
        }
    
        override public function set data(value:Object):void
        {
            super.data = value;
            invalidateProperties();
        }
    
        override protected function commitProperties():void
        {
            super.commitProperties();
            if (owner is ListBase)
                selected = ListBase(owner).isItemSelected(data);
        }
    
        /* eat keyboard events, the underlying list will handle them */
        override protected function keyDownHandler(event:KeyboardEvent):void
        {
        }
    
        /* eat keyboard events, the underlying list will handle them */
        override protected function keyUpHandler(event:KeyboardEvent):void
        {
        }
    
        /* eat mouse events, the underlying list will handle them */
        override protected function clickHandler(event:MouseEvent):void
        {
        }
    
        /* center the checkbox if we're in a datagrid */
        override protected function updateDisplayList(w:Number, h:Number):void
        {
            super.updateDisplayList(w, h);
    
            if (listData is DataGridListData)
            {
                var n:int = numChildren;
                for (var i:int = 0; i < n; i++)
                {
                    var c:DisplayObject = getChildAt(i);
                    if (!(c is TextField))
                    {
                        c.x = (w - c.width) / 2;
                        c.y = 0;
                    }
                }
            }
        }
    }
    }
    

    Then in your flash page:

    <obj:CheckboxDataGrid id="notificationsCheckboxGrid"
    dataProvider="{_myModel._grid}"
    allowMultipleSelection="true"
    showHeaders="false"                            
    change="emailAddressesSelected()">
    <qmsAdmin:columns>                                     
        <mx:DataGridColumn width="20" sortable="false" itemRenderer="CheckBoxRenderer"/>
        <mx:DataGridColumn width="150" dataField="email"/>
        <mx:DataGridColumn dataField="notificationType"/>
    </qmsAdmin:columns>     
    </obj:CheckboxDataGrid>
    

    Notice the change method “emailAddressesSelected()”. Calls this method:

    private function emailAddressesSelected():void
    {
    _emailAddressIndexesSelected = notificationsCheckboxGrid.selectedIndices;
    }
    

    _emailAddressIndexesSelected is just an Array object in the class defined as:

    private var _emailAddressIndexesSelected:Array;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 254k
  • Answers 254k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use [executeUpdate()](http://java.sun.com/javase/6/docs/api/java/sql/PreparedStatement.html#executeUpdate()) to execute the desired DDL, e.g.… May 13, 2026 at 10:09 am
  • Editorial Team
    Editorial Team added an answer You can show one of those fancy loading gifs found… May 13, 2026 at 10:09 am
  • Editorial Team
    Editorial Team added an answer My idea would be to create a field in your… May 13, 2026 at 10:09 am

Related Questions

<mx:DataGrid id=dg1 dataProvider={cNumbersList} cornerRadius=3 allowMultipleSelection=true change=selectedItem=(event.target as DataGrid).selectedItem.contactName; selectedSno=(event.target as DataGrid).selectedItem.contactNo; dropEnabled=true dragMoveEnabled=true dragEnabled=true
I'm trying to create a datagrid which will resize vertically to ensure all the
In a Flex DataGrid's first row, the itemRenderer will initialize twice. Tracing the results
I am getting return type as array from PHP. When i populate in my
I have a data grid that has a checkbox item renderer in a cloumn

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.