8 Replies Latest reply on Feb 15, 2009 6:53 PM by VarioPegged

    Nested Repeater and Binding Problem - Please Help

    Gregory Lafrance Level 6
      I have nested repeaters and binding seems to work with the outer repeater, but not with the inner repeater. I have boiled it down to a pretty concise case. If someone could offer hints I would be most appreciative!

      I understand the objects I am using to store data could be different, but it only looks strange because I had to boil down a complex case to a simple case.

      Type a user and then an email address then click to add them, the user TextInput and label gets created, but not the email address label and text input.

      Basically I want users in an ArrayCollection, and their multiple email addresses in an ArrayCollection stored in an Object, where I get that email ArrayCollection using the user as the key to the object acting as an associative array.

      The attached code should compile fine, so please have a go at this. Thanks!
        • 1. Re: Nested Repeater and Binding Problem - Please Help
          Gregory Lafrance Level 6
          I made these changes after seeing another post, but no solution:

          [Bindable(event="emailsAdded")] public var _emailAddresses:Object = new Object;

          private function addUser():void {
          userData.setEmailAddresses4User(userTxt.text, emailAddressesAC);
          this.dispatchEvent(new Event("emailsAdded"));
          }
          • 2. Re: Nested Repeater and Binding Problem - Please Help
            Level 7

            "Greg Lafrance" <webforumsuser@macromedia.com> wrote in message
            news:gn5p1k$cv9$1@forums.macromedia.com...
            >I have nested repeaters and binding seems to work with the outer repeater,
            >but
            > not with the inner repeater. I have boiled it down to a pretty concise
            > case. If
            > someone could offer hints I would be most appreciative!
            >
            > I understand the objects I am using to store data could be different, but
            > it
            > only looks strange because I had to boil down a complex case to a simple
            > case.
            >
            > Type a user and then an email address then click to add them, the user
            > TextInput and label gets created, but not the email address label and text
            > input.
            >
            > Basically I want users in an ArrayCollection, and their multiple email
            > addresses in an ArrayCollection stored in an Object, where I get that
            > email
            > ArrayCollection using the user as the key to the object acting as an
            > associative array.

            I wouldn't bind to methods like that...I'd make properties and bind to
            those.


            • 3. Re: Nested Repeater and Binding Problem - Please Help
              Level 7

              "Greg Lafrance" <webforumsuser@macromedia.com> wrote in message
              news:gn5ppu$dqo$1@forums.macromedia.com...
              >I made these changes after seeing another post, but no solution:
              >
              > [Bindable(event="emailsAdded")] public var _emailAddresses:Object = new
              > Object;
              >
              > private function addUser():void {
              > userData.setEmailAddresses4User(userTxt.text, emailAddressesAC);
              > this.dispatchEvent(new Event("emailsAdded"));
              > }
              >

              I don't see anything in your binding code that references that object, so I
              doubt that's helping you at all.


              • 4. Re: Nested Repeater and Binding Problem - Please Help
                Gregory Lafrance Level 6
                Yeah, I realized that the function is probably called at app startup, but not again. Because the inner repeater is populated using an associative array like object.propertyName, how should I achieve binding in this case? Should I use a binding function, or reorganize my data?
                • 5. Re: Nested Repeater and Binding Problem - Please Help
                  Level 7

                  "Greg Lafrance" <webforumsuser@macromedia.com> wrote in message
                  news:gn7206$1st$1@forums.macromedia.com...
                  > Yeah, I realized that the function is probably called at app startup, but
                  > not
                  > again. Because the inner repeater is populated using an associative array
                  > like
                  > object.propertyName, how should I achieve binding in this case? Should I
                  > use a
                  > binding function, or reorganize my data?

                  I'll see if I have time tomorrow to throw something together...


                  • 6. Nested Repeater and Binding Problem - Please Help
                    VarioPegged Level 2
                    I'll jump in here too. A couple different ways to do this, but I think your logic was just a little off. Look at the reworked UserInfo.as.

                    There should be two bits of information passed to setEmailAddresses4User(): A user and an email address as strings. You can then assemble the proper AC and object structure within UserInfo based on these strings. It ensures the integrity of your AC and objects.

                    Although not needed here, I added a getter for emailAddresses in UserInfo, just in case you need to get at that info from the outside as well.

                    Then finally call refresh() on the _users AC to have the repeaters work properly.

                    TS
                    • 7. Re: Nested Repeater and Binding Problem - Please Help
                      Gregory Lafrance Level 6
                      Thanks for the help Vario. I'll try it out. Give me a call again. I'd like to see how you are doing.
                      • 8. Nested Repeater and Binding Problem - Please Help
                        VarioPegged Level 2
                        You're welcome Greg. There should be no need to create bindings other than what I have if I'm understanding what you want to do.

                        Things are going well, surprisingly enough...even in an economy such as this.

                        I'll give you a call again soon.

                        TS