1 Reply Latest reply on Feb 27, 2009 6:20 AM by Newsgroup_User

    Conditional formatting in a repeater

    vikceo
      Hie

      My xml is like this:

      <stat>
      <empResults>guan completing 9 years in 6 months and 5 days.</empResults>
      <empStatus>INVALID</empStatus>
      </stat>
      <stat>
      <empResults>kumar completing 4 years in 11 months and 18 days.</empResults>
      <empStatus>VALID</empStatus>
      </stat>
      <stat>
      <empResults>kies completing 4 years in 11 months and 26 days.</empResults>
      <empStatus>INVALID</empStatus>
      </stat>
      <stat>
      <empResults>roy completing 4 years in 11 months and 26 days.</empResults>
      <empStatus>VALID</empStatus>
      </stat>

      I want to show it in my vbox as text boxes like

      guan completing 9 years in 6 months and 5 days.
      kumar completing 4 years in 11 months and 18 days.
      kies completing 4 years in 11 months and 26 days.
      roy completing 4 years in 11 months and 26 days.

      Please note color is red for those whose empStatus in INVALID.

      currently my code is like:
      <mx:Repeater id="upcomingRepeater" dataProvider={<myXML>}>
      <mx:Text id="upcomingText" text="{upcomingRepeater.currentItem}"/>
      </mx:Repeater>

      This above code shows me all in black as I have not applied this empStatus to format. So how to do that?


        • 1. Re: Conditional formatting in a repeater
          Level 7

          "vikceo" <webforumsuser@macromedia.com> wrote in message
          news:go8ne4$elf$1@forums.macromedia.com...
          > Hie
          >
          > My xml is like this:
          >
          > <stat>
          > <empResults>guan completing 9 years in 6 months and 5 days.</empResults>
          > <empStatus>INVALID</empStatus>
          > </stat>
          > <stat>
          > <empResults>kumar completing 4 years in 11 months and 18
          > days.</empResults>
          > <empStatus>VALID</empStatus>
          > </stat>
          > <stat>
          > <empResults>kies completing 4 years in 11 months and 26 days.</empResults>
          > <empStatus>INVALID</empStatus>
          > </stat>
          > <stat>
          > <empResults>roy completing 4 years in 11 months and 26 days.</empResults>
          > <empStatus>VALID</empStatus>
          > </stat>
          >
          > I want to show it in my vbox as text boxes like
          >
          > guan completing 9 years in 6 months and 5 days.
          > kumar completing 4 years in 11 months and 18 days.
          > kies completing 4 years in 11 months and 26 days.
          > roy completing 4 years in 11 months and 26 days.
          >
          > Please note color is red for those whose empStatus in INVALID.
          >
          > currently my code is like:
          > <mx:Repeater id="upcomingRepeater" dataProvider={<myXML>}>
          > <mx:Text id="upcomingText" text="{upcomingRepeater.currentItem}"/>
          > </mx:Repeater>
          >
          > This above code shows me all in black as I have not applied this empStatus
          > to
          > format. So how to do that?

          color =
          "{XML(upcomingRepeater.currentItem)..child('empStatus')=='INVALID'?0xFF0000:0}"

          HTH;

          Amy