1 Reply Latest reply on Jan 6, 2010 9:09 AM by hVenus

    I need s:list display 2 colums item, like mx:tilelist.

    hVenus

      RT,

      How can I do, I need 2 colums item,  I write itemrenderer, set some properties, but it's not work.

      I want s:list like mx:tilelist.

      Please help me.

       

      code is here:

            c2.mxml

      <?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/halo" minWidth="1024" minHeight="768">
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
              <mx:CurrencyFormatter id="currFormatter" precision="2" />
          </fx:Declarations>
          <s:layout><s:BasicLayout /></s:layout>
         
          <fx:Script>
              <![CDATA[
                  import mx.collections.ArrayCollection;
                  public var  myar:ArrayCollection = new ArrayCollection(
                  [{name:"The",   price:"0.23"},
                  {name:"quick", price:"1.03"},
                  {name:"brown", price:"0.98"},
                  {name:"fox",   price:"1.19"},
                  {name:"jumps", price:"0.28"},
                  {name:"over",  price:"0.42"},
                  {name:"the",   price:"0.09"},
                  {name:"lazy",  price:"0.81"},
                  {name:"dog",   price:"0.72"}]
                  );
                 
                 
                  private function comboBox_labelFunc(item:Object):String {
                      return item.name + "\t" + currFormatter.format(item.price);
                  }
              ]]>
          </fx:Script>
         
         
          <s:List id="comboBox"
              itemRenderer="TabItemRenderer"
              horizontalCenter="-157"
              verticalCenter="-124"
              width="250"
              height="500"
               dataProvider="{myar}"
              >
             
          </s:List>
         
         
      </s:Application>

       

      tabItemRenderer.mxml

      <?xml version="1.0" encoding="utf-8"?>
      <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/halo"
                      xmlns:fxg="http://ns.adobe.com/fxg/2009">
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
          <s:layout><s:BasicLayout /></s:layout>
         
             
              <mx:Tile   direction="horizontal" autoLayout="true" tileWidth="100" tileHeight="50" horizontalGap="0"  >
                 
                  <s:Button  label="{data.name}" width="100%" height="100%"  />
              </mx:Tile>
         
      </s:ItemRenderer>

       

      this only one colum.

       

      please!!!!

        • 1. Re: I need s:list display 2 colums item, like mx:tilelist.
          hVenus Level 1

          I know it.

           

          in c2.mxml change to:

           

          <s:List id="comboBox"
                  itemRenderer="TabItemRenderer"
                  horizontalCenter="-157"
                  verticalCenter="-124"
                  width="250"
                  height="500"
                   dataProvider="{myar}"
                  >
                 <s:layout>
                      <s:TileLayout requestedColumnCount="2" />
                  </s:layout>

                 
              </s:List>

          add s:layout here.

           

          and tabItemRenderer.mxml, delete mx:Tile.

           

          set s:TileLayout  requestedColumnCount = 2.

           

          and ,it's working.