Skip navigation
Currently Being Moderated

Check box rendering problem in List.

Jul 13, 2011 2:39 AM

Hi All,


            I am using list component in my app and list component allows multiple selections. I am using an itemrenderer having the checkbox and label in hbox.

Rendering is working fine. but when I selected three or four items randomly using check boxes in list and If I scroll it vertically (up and down) the selections of check boxes changedto another items. If I keep on doing this finally I will get all the check boxes selected. but I have selected only three check boxes.


             I wanted get out of this problem. If i selected two or three checkboxes and when scroll it vertically it should remain as it is. Selections should not change... please help on this.. 



                 I am posting the code of Item renderer



<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="" horizontalGap="2"
    width="100%" height="100%"
        [Event(name="checkBoxEvent", type="")]


            import mx.controls.List;
            import mx.controls.listClasses.ListData;
            import mx.controls.dataGridClasses.DataGridListData;
            import mx.controls.listClasses.BaseListData;
            private var _listData:BaseListData;
            private var _list:List;
            public function init():void
                this.addEventListener(Event.CHANGE, onChangeEvent);
            public function get listData() : BaseListData
                return _listData;
            public function set listData( value:BaseListData ) : void
                _listData = value;
                    _list = listData.owner as List
            override public function set data(value:Object):void
       = value;
            protected function handleClick(event:MouseEvent):void
                    check.selected = false;
                    check.selected = true;
            protected function checkBoxSelected(event:Event):void
                        dispatchEvent(new CheckBoxEvent(CheckBoxEvent.CHECKBOX_EVENT, data.mx_internal_uid,data as Object, true,true));
                        dispatchEvent(new CheckBoxEvent(CheckBoxEvent.CHECKBOX_EVENT, data.mx_internal_uid,data as Object, false,true));
            protected function onChangeEvent(event:Event):void
    <mx:CheckBox id="check" change="checkBoxSelected(event)" click="handleClick(event)"/>
    <mx:Label id="lb" width="100%" height="100%" htmlText="{_list.labelFunction(data)}"/>



I have faced this problem in so many times in so many list component..  Please help me on this...

  • Currently Being Moderated
    Jul 13, 2011 8:48 AM   in reply to flex4

    The selected state of the checkbox must be tied to some aspect of the data

    item.  See the posts on my blog about item renderers.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points