Thanks for your respone.  Explain what you mean by, "underlying value" ?


I am setting the checkbox to be checked or not by doing: 

if(item[getDataLabel()] == "Y") { cb.selected = true } else {
cb.selected = false };

>>   Perhaps you need to call the superclass version of 
>>setValue() somewhere in there?

Already being done as this is an inherited function.  I am getting the
label of the current cell and using that to select the checkbox. But
this probably shouldn't be done inside this function as the setValue
function is called every time the datagrid cell is interacted with.  Not
sure how this is normally done, and how to do this better, this is my
first experience with the CellRenderer API.  Thanks for any advice.

Jason Merrill
Bank of America 
Learning & Organizational Effectiveness
 
 
 
 
 
 

>>-----Original Message-----
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
>>Sent: Tuesday, February 20, 2007 3:49 PM
>>To: Open Source Flash Mailing List
>>Subject: Re: [osflash] OT: CellRenderer API & setValue
>>
>>Jason,
>>   It's been a while since I did this sort of thing, but 
>>shouldn't you be setting the underlying value in setValue() 
>>as well as working out what to display? Based on the 'sel' parameter?
>>
>>   Perhaps you need to call the superclass version of 
>>setValue() somewhere in there? Or set 
>>item[getDataLabel()]=(sel)?'Y':'N'; or somesuch?
>>
>>HTH,
>>   Ian
>>
>>On 2/20/07, Merrill, Jason <[EMAIL PROTECTED]> wrote:
>>> Flashcoders doesn't seem to be responding, so I hope it's OK to ask
>>> here:
>>>
>>> I'm using the CellRenderer API with a datagrid for the first time. 
>>> It's working great, I'm adding checkboxes to cells in the datagrid.
>>>
>>> However, in my class CheckBoxCell which extends 
>>mx.core.UIComponent, I 
>>> added some code to the inherited setValue method:
>>>
>>>         function setValue(str:String, item:Object, 
>>sel:Boolean) : Void
>>>         {
>>>                 cb._visible = (item!=undefined);
>>>                 if(item[getDataLabel()] == "Y") { 
>>cb.selected = true } 
>>> else { cb.selected = false };
>>>         }
>>>
>>> This works fine to make all my checkboxes checked or not checked if 
>>> the item's data in dataprovider is Y or N, but it also 
>>causes some odd 
>>> behaviour in that the checkbox, after clicked by the user, 
>>will revert 
>>> back to it's original dataprovider value. I think I 
>>understand why, as 
>>> the datagrid keeps it's children rendered to it's set dataprovider 
>>> values, but I'm not sure what to do about it.  Do I need to 
>>change the 
>>> dataprovider values first?  If so, how from within the CheckBoxCell 
>>> class?  Or how do you normally handle this?
>>>
>>> Thanks,
>>>
>>> Jason Merrill
>>> Bank of America
>>> Learning & Organizational Effectiveness
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> osflash mailing list
>>> [email protected]
>>> http://osflash.org/mailman/listinfo/osflash_osflash.org
>>>
>>
>>_______________________________________________
>>osflash mailing list
>>[email protected]
>>http://osflash.org/mailman/listinfo/osflash_osflash.org
>>

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to