Skip navigation
Currently Being Moderated

How to update attribute of all rows in single shot

Jul 23, 2012 3:55 AM

Tags: #flex #xml #attribute

Hi,

 

I have a XMLList:

myList =

<row id="1" name="abcg" status="checked"/>

<row id="2" name="abcd" status="checked">

     <row id="22" name="abcd" status="checked"/>

     <row id="23" name="abcd" status="checked">

     <row id="24" name="abcd" status="checked">

          <row id="241" name="abcdef" status="unchecked"/>

          <row id="242" name="ghijk" status="unchecked"/>

          <row id="243" name="lmnop" status="unchecked"/>

     </row>

<row id="3" name="abce" status="checked"/>

<row id="4" name="abcf" status="checked"/>

 

I tried both, myList.row..@status = 'unchecked';  and also myList.row.@status = 'unchecked';

but I get this error message:

"Error #1089: Assignment to lists with more than one item is not supported."

 

Is there a way to update all the rows' (parent and children) 'status' attribute's value to 'unchecked' with a single line of code? Can you kindly let me know how can we achieve this?

 

 

Warm regards,

Deepak

 
Replies
  • Currently Being Moderated
    Jul 25, 2012 4:43 PM   in reply to megharajdeepak

    I think something like this should work:

     

    myList..row.(@status=="checked").@status = "unchecked";

     

    ...my e4x is a bit rusty though.

     

    *edit*

     

    I think your original idea may work just as well. Just move the double dot to the left of "row".

     
    |
    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