2 Replies Latest reply on Aug 13, 2010 10:48 PM by Subeesh Arakkan

    Repeater background

    Devtron Level 3

      Hello,

       

      I have a Repeater contained within a Panel.The Repeater has 6 checkboxes and 2 datetimepickers.

       

      I would like to seperate the Repeater controls with a background, between each Repeated definition.

       

      What should I place around the Repeater to seperate the objects?

       

      Here is my code (for the Repeater):

          <mx:Repeater id="myrep" dataProvider="{deviceList}">
              <mx:Spacer height="20%" />   
              <mx:CheckBox name="{myrep.currentItem.oid}" id="chkDevice" label="Device:  #{myrep.currentItem.name} - oid: #{myrep.currentItem.oid} " click="checkBox_click(event);"/>
                  <mx:CheckBox id="chkIndoorTemp" label="Indoor Temperature" />
                  <mx:CheckBox id="chkOutdoorTemp" label="Outdoor Temperature"/>
                  <mx:CheckBox id="chkCoolPoint" label="Cool Point"/>
                  <mx:CheckBox id="chkHeatPoint" label="Heat Point"/>
                  <mx:CheckBox id="chkHumidity" label="Humidity"/>
             
              <timePicker:DateTimePicker selectedDate="{new Date()}" id="pickerBegin" minuteIncrement="5" />
              <timePicker:DateTimePicker selectedDate="{new Date()}" id="pickerEnd" minuteIncrement="5" />
             
          </mx:Repeater>  

        • 1. Re: Repeater background
          Devtron Level 3

          This should be a rather easy question to answer.

           

          I am surprised by the sheer volume of FLEX questions and relatively poor, little to no answers for this stuff.

          • 2. Re: Repeater background
            Subeesh Arakkan Level 4

            Hi,

             

            Try setting alternating item background colors using the following code snippet.

             

            [Bindable]private var colors:ArrayCollection = new ArrayCollection([0xEEEE00,0xE2E2E2]);

             

            <mx:VBox width="500" horizontalCenter="0" height="600">

            <mx:Repeater id="myrep" dataProvider="{dp}">

            <mx:VBox backgroundColor="{colors.getItemAt(myrep.currentIndex % 2) as uint}">

            <mx:Spacer height="20%" />   

            <mx:CheckBox id="chkIndoorTemp" label="Indoor Temperature" />

            <mx:CheckBox id="chkOutdoorTemp" label="Outdoor Temperature"/>

            <mx:CheckBox id="chkCoolPoint" label="Cool Point"/>

            <mx:CheckBox id="chkHeatPoint" label="Heat Point"/>

            <mx:CheckBox id="chkHumidity" label="Humidity"/>

            </mx:VBox>

            </mx:Repeater> 

            </mx:VBox>