5 Replies Latest reply on Sep 19, 2007 7:56 AM by M._Tonelli

    Custom Item Renderer in LIst

      I have a list that has a custom Item Renderer. The Item Renderer has 2 components: 1 is a text box, 1 is a checkbox. The control renders perfectly.

      However, when I go to manipulate values in the individual controls that are on different rows in the listbox, I can't get or set any of them. How do you refer to the specific controls in order to get their values?

        • 1. Re: Custom Item Renderer in LIst
          Are you using a data provider to bind the list values?
          If you are (and I recommend it) then you should just manipulate the data provider itself, rather than the controls.

          Have you got some example code?
          • 2. Re: Custom Item Renderer in LIst
            Trugriff Level 1
            I do have the listbox bound to a data provider and changing values works, etc which is as expected. In this particular case, I have an "Add" button that inserts a row into the list. As expected, the custom item renderer is displayed. I then select the newly inserted row. What I'd like to happen is that once I've selected the row, I'd like to set focus to the text input control that is in the custom item renderer. This is where I cannot determine how to reference the control. I've tried variations of the following syntax, all to no avail:

            (myList is the list control, selectedIndex is the row number that is highlighted and txtColor is the name of the text input control in the custom item renderer)

            • 3. Re: Custom Item Renderer in LIst
              Senor_Roberto Level 1
              Ahh I see, excellent question :)

              When you focus on the selected item in the list, I'm assuming it doesn't just focus on the text field? (that would be too easy...)

              Do you have an AS class extending TextInput as your item renderer or are you using an inline MXML renderer?
              • 4. Re: Custom Item Renderer in LIst
                Trugriff Level 1
                it is a custom component...a horizontal box that contains the 2 controls...textbox and checkbox.

                • 5. Re: Custom Item Renderer in LIst

                  Did that code line -- focusManager.setFocus(myList.selectedIndex.txtColor); -- work?

                  because I'm trying to get a selected item from my list component and I can't, I have a list that render a data provider data using a complex item renderer and I need to access a checkBox defined in the item renderer, How can I do that?

                  Can you help-me please?