Title: Checkbox Cell Renderer

Matt, Code is below. Can you please take a look at it and let me know what I am doing wrong?

 

import mx.core.UIComponent

import mx.controls.CheckBox

 

class com.idt.pcmssearch.parametric.renderers.CheckCellRenderer extends UIComponent

{

 

            var check : MovieClip;

            var listOwner : MovieClip;

            var getCellIndex : Function;

            var getDataLabel : Function;

 

            function CheckCellRenderer()

            {

            }

 

            function createChildren() : Void

            {

                        check = createClassObject(CheckBox, "check", 1, {styleName:this, owner:this});

                        check.addEventListener("click", this);

                        size();

            }

 

            function size() : Void

            {

                        check.setSize(20, layoutHeight);

                        check._x = (layoutWidth-20)/2;

                        check._y = (layoutHeight-16)/2;

            }

           

            function setValue(str : String, currentItem : Object, sel : Boolean) : Void

            {

                        //check._visible = (currentItem!=undefined);

                        check.selected = currentItem[getDataLabel()];

            }

           

            function getPreferredHeight() : Number

            {

                        return 16;

            }

           

            function getPreferredWidth() : Number

            {

                        return 20;

            }

           

            function click()

            {

                        listOwner.editField( getCellIndex().itemIndex, getDataLabel(), check.selected );

            }

           

}

 

Thanks

Agha Mehdi
IDT - eBusiness Program Manager


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Matt Chotin
Sent: Saturday, September 10, 2005 9:16 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Checkbox Cell Renderer

 

I’m guessing that you accidentally have a reference to something that is not being cleared in your renderer.  Remember that the renderer is re-used for many items and as you scroll up and down it changes position.  So maybe there’s an instance variable in your renderer that’s accidentally staying set, i.e., you’re not clearing everything that you need to in your setValue method.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mehdi, Agha
Sent: Friday, September 09, 2005 5:09 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Checkbox Cell Renderer

 

Hi all,

I have a weirdo thing going on with this renderer. When I check the checkbox in the grid, it automatically selects other checkboxes in the same grid randomly. The most interesting part is that when I scroll through the grid, it keeps checking/unchecking the boxes without any reason. Also, when I have some rows checked and I get new data in the grid, it keeps the boxes checked at previous indexes.

Anyone ever ran into this issue?

Thanks

Agha Mehdi

IDT - eBusiness Program Manager

Work: 408.284.8239

Fax:   408.284.2766





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Software design and development Macromedia flex
Software development best practice


YAHOO! GROUPS LINKS




Reply via email to