2 Replies Latest reply on Dec 21, 2010 5:14 PM by saisri2k2

    Resize spark list depending on the dataProvider length

    saisri2k2 Level 4

      How to Resize spark list height depending on the data length?

        • 1. Re: Resize spark list depending on the dataProvider length
          Peter deHaan Level 4

          I believe the Spark List does resize to match the number of items in the data provider. Although it may be constrained to a minimum height/width as defined by it's skin though (112px by 112px, if I recall correctly).

           

          You can probably either try creating a custom Spark List skin without the minWidth and minHeight and see if that helps, or you may have to override the default List layout if you have fewer than 5 items in  your list data provider:

           

          <?xml version="1.0" encoding="utf-8"?>

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                         xmlns:s="library://ns.adobe.com/flex/spark"

                         xmlns:mx="library://ns.adobe.com/flex/mx">

              <s:controlBarContent>

                  <s:Button id="sdkVer" initialize="sdkVer.label = mx_internal::VERSION;" click="System.setClipboard(sdkVer.label);" />

              </s:controlBarContent>

              <s:layout>

                  <s:HorizontalLayout paddingLeft="10" paddingRight="10" paddingTop="10" paddingBottom="10" />

              </s:layout>

           

              <s:List labelField="fontName">

                  <s:layout>

                      <s:VerticalLayout gap="0"  horizontalAlign="contentJustify" requestedRowCount="-1" />

                  </s:layout>

                  <s:dataProvider>

                      <s:ArrayCollection source="{Font.enumerateFonts(true).splice(-3)}" />

                  </s:dataProvider>

              </s:List>

           

          </s:Application>

           

          Peter

          1 person found this helpful