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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:56:44+00:00 2026-06-09T08:56:44+00:00

I’m using a custom DataGrid subclass provided by the code at the top of

  • 0

I’m using a custom DataGrid subclass provided by the code at the top of this page:

http://blogs.adobe.com/aharui/2008/02/checkbox_selection_in_datagrid.html

I’m effectively supplying it an ArrayCollection of two-column DataRows pulled out of a VB.NET webservice. One of the columns is called “isSelected” and is set to either “True” or “False”, and it’s the only column being represented by the checkboxes. Everything is going perfectly, except that I want the code to be able to go in and check and uncheck the checkboxes – at least depending on what the value of isSelected is. My code reads everything out of those checkboxes just fine, with the user being able to set them just fine; it’s just that the DataGrid component is very concealed and confusing to work with, so I haven’t found a way yet to make the code itself set specific checkboxes to either be selected or unselected.

How do you do this? Thanks!

EDIT: The code for the renderer at the moment is this:

package 
{
import flash.display.DisplayObject;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.text.TextField;

import mx.controls.Alert;
import mx.controls.CheckBox;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.ListBase;

/** 
*  The Renderer.
*/
public class CheckBoxRenderer extends CheckBox
{
private var _data:*;  
private var selectedSet:Boolean;

override public function set data(value:Object):void {  
    var newSelected:*;  

    //so we don't have to rewrite the label stuff  
    super.data=value;  
    _data = value;  

    if (listData && listData is DataGridListData && DataGridListData(listData).dataField != null)  
    {  
        newSelected = _data[DataGridListData(listData).dataField];  
    }  
    else if (listData)  
    {  
        if (selectedField)  
            newSelected = _data[selectedField];  
    }  
    else  
    {  
        newSelected = _data;  
    }  

    if (newSelected !== undefined)  
    {
        /*if (newSelected is XMLList) {  
            newSelected = newSelected[0];  
            selected = (newSelected == 'true' ? true : false);  
        } else {
            selected = newSelected as Boolean;  
        }*/
        selected = (newSelected == "True" ? true : false);
    }
}  

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;
            }
        }
    }
}

}

}

The selected field for the checkboxes is getting set to the right thing, but it’s not visually showing up as being check when selected gets set to true. What else am I missing?

  • 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-06-09T08:56:45+00:00Added an answer on June 9, 2026 at 8:56 am

    The problem is not with DataGrid, but with Checkbox, which is not implemented correctly. See my comments here for code on how to override set data so that if the dataField contains true, selected will work. You’ll need to look at the pathway for XMLList for some ideas on how to tweak it to work for your value of “True.” Or you could convert that value to the boolean true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm making a simple page using Google Maps API 3. My first. One marker
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.