3 Replies Latest reply on Jul 3, 2007 1:24 PM by ntsiii

    Repeater refresh bug?

    frenchi30 Level 1
      I am having a problem with nested Repeater controls not refreshing properly to reflect the data that is bound to the data provider for each of the Repeater controls. My problem is related to the following:

      I have two classes, say Parent and Child which are as follows:

      [Bindable]
      public class Parent {
      public var children : ArrayCollection = new ArrayCollection();
      }

      [Bindable]
      public class Child {
      public var name : String = “foo”;
      public var isEnabled : Boolean = true;
      public var isSelected : Boolean = false;
      public var enabledChildren : ArrayCollection = …;
      public var disabledChildren : ArrayCollection = …;
      }

      The enabledChildren and disabledChildren collections contain references to other Child objects that exist within the children collection of another parent.

      Then I have the following nested Repeater control structure:

      <mx:Repeater id="parentRepeater" dataProvider="{model.parents}">
      <mx:Repeater id="childRepeater" dataProvider="{ parentRepeater.currentItem.options}">
      <mx:CheckBox label="{childRepeater.currentItem.name}"
      enabled="{childRepeater.currentItem.isEnabled}"
      selected="{childRepeater.currentItem.isSelected}"
      click="optionClicked(event);" />
      </mx:Repeater>
      </mx:Repeater>

      Where model.parents references an ArrayCollection of Parent objects.

      The problem that I am having is that when a checkbox is clicked, the optionClicked function is called, and within this function there is logic that iterates over the enabledChildren and disabledChildren collections of the Child object bound to the clicked checkbox, and it sets the isEnabled and isSelected properties of each Child object in these collections to either true or false, depending on the current state of the checkbox that was clicked.

      However, when I do this, the checkbox controls are not updated properly, as the enabled and/or selected state of the checkbox does not accurately reflect the value that is stored in the object that is bound to this control.

      The only way that I am able to have the checkboxes redraw properly is to do a manual refresh on the model.parents collection, but doing so causes the view to flicker pretty noticeably.

      Is there any way to perform this type of operation and have all of the controls update properly without having to do the manual refresh? I know that the data that is bound to the controls is being updated properly, but the actual view of the controls is not being updated.

      Any help that could be offered on this matter would be greatly appreciated.
        • 1. Re: Repeater refresh bug?
          frenchi30 Level 1
          anyone? Please.... This is killing me

          Any thoughts at all would be great.

          Thank-you
          • 2. Re: Repeater refresh bug?
            Sigmar85
            Its impossible to use a two-dimensions Array with a Repeater.

            An other thing is :

            "parentRepeater.currentItem.options" doesn't work. Repeater don't want to get the value in a currentItem...

            That 's bizarre
            • 3. Re: Repeater refresh bug?
              ntsiii Level 3
              "Its impossible to use a two-dimensions Array with a Repeater. " that is not correct. It is true that you should avoid arrays as dataPRoviders, but I see you are using an arrayCollection, which is good. What are (dataType) the child objects of the model.parents?

              what you have is close, I don't see an obvious problem. How are you updating the dataProvider? You must be using the Collection API, and never the low-level array[] notation.

              Tracy