7 Replies Latest reply on Nov 13, 2006 1:53 AM by romanczar

    Automatically resize the height

    romanczar Level 1
      I am trying to bild an application where I have a list of items aligned vertically (Like a 1-column TileList or List).

      The problem is: I am using 2 states in my custom ItemRenderer to expand the information, whcih also expands the height.

      But when I do that with a TileList or List the height of the row is not expanded correspondingly. Thats why right now I am using a mx:Grid or a mx:Panel. Here it is no problem, the following items simply get moved down or up when I open or close items.

      But I have 2 problems now: How can I get alternating background colors? How can I select one item completly like in a TileList, List or Datagrid.

      I also played with the datagrid but here it is the same. The row height does not adopt dynamically to the chaning content. How can I achieve that?

      Or would an mx:Tree be the better solution? How can I use custom itemrenderers with trees? I only need 2 levels (1: TITEL, 2:CUSTOM RENDERER).
        • 1. Re: Automatically resize the height
          peterent Level 2
          Did you set variableRowHeight="true" on the List control?
          • 2. Re: Automatically resize the height
            romanczar Level 1
            Thanks, I will try that.

            How could I achieve the same by using a Tree? The branch would be an element for which I need a custom Item renderer to combine several tags of the xml/array in an HBox. The same goes foer the leaves.
            • 3. Automatically resize the height
              romanczar Level 1
              Tried it.

              Did not work in TileList.

              In List it worked more or less... there seems to be a maximum rowHeight of 250px, although in List.as there is no limit anywhere like that...

              Do you have an idea?
              • 4. Re: Automatically resize the height
                peterent Level 2
                It definitely won't work in TileList - that control enforces the size policy so all of the elements are the same.

                I suggest you open a formal support incident for the 250px issue; I'm not aware of any limitation.

                An alternative is to create your own list control - a somewhat advanced step, but that's what makes Flex a great UI - its adaptability.

                As for the tree, like the list, there can only be 1 item renderer but it could have 2 states. One state could be for the branches (your title) and the children could be in the second state. But experiment a bit first.
                • 5. Re: Automatically resize the height
                  romanczar Level 1

                  I found out something: There is no "real" limitation. But if the content has not set any height it is set to something around 250px.

                  I also ussed your code for testing and simply increased the number of items in the list so that it can not fit in any more ( http://weblogs.macromedia.com/pent/archives/2006/04/a_list_itemrend.cfm). There I have the same behaviour.

                  But if I set the height of the List containing the car models manually, e.g. to 400 the main List row has the right size.

                  So all I need now is to know how I can set the height of the list containing yoru car models to the "perfect" height to match ALL the content. Then the main row should adapt correctly...
                  • 6. Re: Automatically resize the height
                    romanczar Level 1
                    Again me... I played around a little bit.

                    If I use mx:List with variableRowHeight=true this works fine with small height between1 and ~250 without setting the height of the contentn fix.

                    If I set the height of the content of the row Fix (e.g. in the ItemRenderer) it works also with big heights 250<.

                    But It seem like the rows don't get the row height correctly when I use VBox in my Item renderer which has no fixed height for its content but is normally higher that 250...

                    Any suggestions? it does not seem to be a problem of my code as this also occurs with your car example if you increase the content to crate a long list of cars...
                    • 7. Re: Automatically resize the height
                      romanczar Level 1
                      And more information: the information is definitly not my ItemRenderer. I tried it by simply putting them in a VBox with a repeater.

                      So it seems List & Datagrid have some Error with detecting how big its content really is when you are using dynamic repeaters in the custom content ItemRenderer.