4 Replies Latest reply on Aug 13, 2007 1:27 AM by jogla

    Swap dataProvider

      I am building an application in Flex using Yahoo! Answers API. The input to this application is a keyword. An API call is made using this keyword. I display all the relevant questions in a list. On clicking on any question, I direct the user to Yahoo Answers relevant webpage. I am trying to do some changes here.

      I want to display the answers in the same list where I had displayed the questions. Effectively, I want to swap the list's content.

      I have tried this with static data, as in where we have data predefined in an array and we use it with the dataProvider. It works fine and you will find many examples doing just that. The problem here is, I am getting the answers data from Yahoo! and am not able to display it in the same list. Can I swap the dataProvider content?

      Another question is: Can I resize each individual item in the list dynamically? ie. depending on the text's size can I resize the item dimensions?

      Should I use any other component? I tried Repeater, but the drawback with it is that I cannot select any item.
        • 1. Re: Swap dataProvider
          ntsiii Level 3
          Yes, you can change the dataProvider data easily. Simply re-assign the dataProvider to a different variable, or re-populate the variable and re-assign it, or bind to the variable and update it.

          You could make a repeater item be selectable by putting an event handler on the container that holds the components. You can also use a customRenderer with list. I do not know if list has variableRowHeight. DataGrid does.

          • 2. Re: Swap dataProvider
            jogla Level 1

            can i really tell Flex to make these repeater items selected /selectable or do i have to implement the selection myself using a mouseListener or some kind of this?

            Greetings Jogla
            • 3. Re: Swap dataProvider
              ntsiii Level 3
              If the repeated component needs to act like a single clickable button, and does not have any subcomponents that are interactive, then on the outer tag of the repeated stuff set: mouseChildren="false" buttonMode="true"

              • 4. Re: Swap dataProvider
                jogla Level 1
                But.. is there a kind of "visual selection mechanism"?

                If i want to create some kind of "Gui builder" in Flex and want to give a visual feetback when the user selects Components, is there any kind of mechanism that is _already build in_ to show, that a component is selected?

                If not, whats the way to implement this? Creating a Canvas with a border and putting it beneath the component? Or are there other possibilities.

                Greetings Jonathan