You are correct, I never was really testing selectedValue = null, since
initially all the dataProvider items are lacking the selectedValue
attribute entirely.  

 

RGB.selection = null; is the solution, yayy, thanks!

 

The fact that  "If no RadioButton is selected, this property is null."
clearly does NOT mean setting the property to null means no RadioButton
is selected.  I ahould have read 10 lines down in the docs where it says
about "selection": "Setting this property to null deselects the
currently selected RadioButton control".

 

Thanks, all!

Tracy

 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Alex Harui
Sent: Thursday, August 30, 2007 2:02 AM
To: [email protected]
Subject: RE: [flexcomponents] ListItemRenderer,selectedValue assignment
in commitProperties not "taking"

 

When you say you set selectedVlaue = null and it works fine, what do you
mean by that?  I don't see how it would change the selectedValue of an
initialized set of RBs because the RGB tries to find the RB with the
matching value and select it, and I'll bet none of RB's have a value of
null.

 

Are you trying to unset all RBs?  You might try setting RGB.selection =
null, or maybe RGB.selection.selected = false;

 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt
Sent: Wednesday, August 29, 2007 9:05 PM
To: [email protected]
Subject: [flexcomponents] ListItemRenderer,selectedValue assignment in
commitProperties not "taking"

 

My renderer is a modified copy of ListItemRenderer that adds some
components, toggling their visibility based on the item data.  Almost
everything is working, except:

One of the components is a RadioButtonGroup.  In the commitProperties
method, I look a the item data(XML) and get the value of a selectedValue
attribute. If the atribute is null or empty, I set the RBG.selectedValue
= null; This works fine, until I scroll.

When I scroll, the recycled renderer gets the correct item, with a
null/empty attribute, sets the selectedValue to null, but the
selectedValue assignment does not "take".  I test the value in the next
line and it has the value from the previous item.  

Here are the snippets:

override protected function commitProperties():void

{

  trace("commitProperties()")

  super.commitProperties();

...

  sTempValue = _data.attribute("selectedValue");

  trace("...SETTING Item #" + [EMAIL PROTECTED]);

  trace(".....attribute value=" + sTempValue)

  if (sTempValue.length > 0)  {

     trace("++++++ non-empty attribute value, setting selectedValue=" +
sTempValue)

     rgbValue.selectedValue = sTempValue;

   }

   else  {

     trace("------ null attribute value, setting selectedValue=NULL" )

    rgbValue.selectedValue = null;

   }

   //now check the selecteedvalue

   if (rgbValue.selectedValue != null)  {

     trace("......Check the selectedValue, item" + [EMAIL PROTECTED] +
".selectedValue=" + rgbValue.selectedValue);

     trace("")

   }

And the trace for a true value item:

...SETTING Item #1

.....attribute value=P

++++++ non-empty attribute value, setting selectedValue=P

......Check the selectedValue, item1.selectedValue=P

And the trace for a scrolled item:

...SETTING Item #28

.....attribute value=
<===ATTRUBUTE IS EMPTY

------ null attribute value, setting selectedValue=NULL
<===SETTING TO NULL

......Check the selectedValue, item28.selectedValue=P           <===WTF?

 

I'll attach the full IR as well.

Thanks, 

Tracy

<<LIR.txt>> 

 

 

Reply via email to