4 Replies Latest reply on Apr 3, 2011 10:48 AM by pol2095

    Spark List rowCount property

    pol2095 Level 1

      Hello,

       

      how you can set the rowCount visible on a Spark list, <mx:List> had rowCount property for the limit the displayed items. <s:List> doesn't.

       

      <s:List id="list" width="100%">
       <s:layout>
        <s:VerticalLayout requestedRowCount="3" gap="0" horizontalAlign="contentJustify" />
       </s:layout>
      </s:List>
      

       

      "layout" doesn't work properly in flex 4.5 hero mobile

       

      thanks.

        • 1. Re: Spark List rowCount property
          Shongrunden Adobe Employee

          I believe requestedRowCount should do what you are looking for.

           

          This sample application seems to work fine for me in Flex 4.5:

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

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

           

              <s:List width="100%">

                  <s:layout>

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

                  </s:layout>

                  <s:dataProvider>

                      <s:ArrayList>

                          <fx:String>0</fx:String>

                          <fx:String>1</fx:String>

                          <fx:String>2</fx:String>

                          <fx:String>3</fx:String>

                          <fx:String>4</fx:String>

                          <fx:String>5</fx:String>

                          <fx:String>6</fx:String>

                      </s:ArrayList>

                  </s:dataProvider>

              </s:List>

           

          </s:Application>

          • 2. Re: Spark List rowCount property
            pol2095 Level 1

            if ArrayList is empty,requestedRowCount doesn't work

            <s:List width="400" id="lis">
                <s:layout>
                    <s:VerticalLayout requestedRowCount="3" gap="0" horizontalAlign="contentJustify"/>
                </s:layout>
                <s:dataProvider>
                    <s:ArrayList/>
                </s:dataProvider>
            </s:List>

            • 3. Re: Spark List rowCount property
              Shongrunden Adobe Employee

              I think you'll need to provide a typicalItem if there is no data in the dataProvider (the typicalItem defaults to the first item in the dataProvider).

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

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

               

                  <s:List width="100%">

                      <s:layout>

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

                      </s:layout>

                      <s:typicalItem>

                          <fx:String>0</fx:String>

                      </s:typicalItem>

                      <s:dataProvider>

                          <s:ArrayList />

                      </s:dataProvider>

                  </s:List>

               

              </s:Application>

              • 4. Re: Spark List rowCount property
                pol2095 Level 1

                thank you