0 Replies Latest reply on Aug 26, 2014 2:26 AM by huutaisc

    how to control item in List

    huutaisc

      when i create new item in list , how to focus or select the new item was created .

      Here my code

       

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

      <!-- dpcontrols\sparkdpcontrols\SparkBBarSimpleModDP.mxml -->

      <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:layout>

              <s:VerticalLayout/>

          </s:layout>

         

          <fx:Script>

              <![CDATA[

                  // Add data item, and button, to the List.

                  private function addFlexToDP():void {

                      myBB.dataProvider.addItem("Flex");

                      addFlex.enabled=false;

                     

                      // how to select or focus to new item created

                  }

             

              ]]>

          </fx:Script>

         

          <s:List id="myBB"> 

              <mx:ArrayCollection>

                  <fx:String>Flash</fx:String>

                  <fx:String>Director</fx:String>

                  <fx:String>Dreamweaver</fx:String>

                  <fx:String>ColdFusion</fx:String>

              </mx:ArrayCollection>

          </s:List>

         

          <s:Button id="addFlex" label="Add Flex"

                    click="addFlexToDP();"/>

         

      </s:Application>