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 381351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:04:38+00:00 2026-05-12T15:04:38+00:00

<mx:DataGrid x=10 y=10 width=180 height=302 id=dgActions dataProvider={actionCollection}> <mx:columns> <mx:DataGridColumn headerText=Action dataField=name/> <mx:DataGridColumn headerText= dataField=setting

  • 0
<mx:DataGrid x="10" y="10" width="180" height="302" id="dgActions" dataProvider="{actionCollection}">
   <mx:columns>
      <mx:DataGridColumn headerText="Action" dataField="name"/>
         <mx:DataGridColumn headerText="" dataField="setting"  width="30" rendererIsEditor="true"> 
         <mx:itemRenderer >
            <mx:Component>
               <mx:Box width="100%" height="100%" horizontalAlign="center" verticalAlign="middle">
                  <mx:CheckBox selected="{data.setting}" click="setActionSetting()">
                     <mx:Script>
                       <![CDATA[
                        private function setActionSetting(){
                           data.setting = String(this.selected);
                        }
                        ]]>
                     </mx:Script>
                  </mx:CheckBox>
               </mx:Box>
            </mx:Component>
         </mx:itemRenderer>
      </mx:DataGridColumn>
   </mx:columns>
</mx:DataGrid>

For some reason I’m getting an error at the data.setting= String(this.selected) line which says “Access to possibly indefined property selected through a reference with static type”.

[edit] The solution to the above problem (albeit not the entire mess) was that once you’re inside a <mx:Component> tag you are within the scope of said component. To get access to the script and nodes outside this component you have to use the outerDocument object.
[end edit]

I’m not sure what it’s expecting, I’m assuming that it’s going to pass the true/false value of the selected(ness) of the checkbox into the method, but it appears not to understand what “this” is, in this context.

Am I doing something obviously wrong? All I want is for the data source to reflect the change in the status that it initially fed into the checkbox.

EDIT:
I just noticed that when I add trace(‘foo’) to the function, it never writes anything back to the console. Is the checkbox’s native behavior (and event capture) preventing it from bubbling past to my function?

Additionally, when I add references to objects outside in the rest of the document, it tells me it doesn’t recognize them. I’m totally confused as to how Flex scopes things… any additional guidance or links to reference would be really handy.

  • 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-12T15:04:38+00:00Added an answer on May 12, 2026 at 3:04 pm

    So, after a great deal of agony I have finally figured out how this all works….

    Joel is on the right track, this doesn’t refer to what you would hope it would refer to (namely the checkbox). Additionally, even if you pass this into the method FROM the checkbox node, it refers to the parent wrapper class and not the checkbox itself. So, the solution is to pass in the event, and then access its target, which FINALLY is the checkbox. And then you’re home.

    In other words…

    <mx:CheckBox  selected="{data.setting}" click="setActionSetting(event)">
        <mx:Script>
            <![CDATA[
                private function setActionSetting(e:Event):void{
                    data.setting = e.target.selected;
                    trace("n=" + data.name + " set to " + data.setting);
                    //the name is the other piece of the data that I omitted for clarity
                }
            ]]>
        </mx:Script>
    </mx:CheckBox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have long tables generated by datagrid control that go beyond the page width.
I have a DataGrid with 5 template columns, However when I try and add
I am using a Datagrid with several columns of data (call it myDG) and
On my windows form, I need to programatically set the width of columns in
I'm having problems trying to adjust the width of a column of a datagrid.
I have a DataGrid that has between 4-10 columns. I want the columns to
I have an ASP.NET Datagrid with several text boxes and drop down boxes inside
I'm working with a datagrid and adapter that correspond with an MSAccess table through
Currently I am binding a dataset with a datagrid. ds = query.ExecuteReadQuery(select PollQuestionText as
I have a situation where I need to work with a datagrid and adding

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.