1 Reply Latest reply on Nov 19, 2009 7:24 AM by rcanulla

    Working with List & Item renderer.

    rcanulla Level 1

      Hi there,

       

      I am working with a list that has a dataProvider that is an array of VO objects. How to I access the selected list item rather than the item renderer's individual components? For example the list has news titles, and dates (will have source, category...), and when I click on the item, I want to display the VO data in another place on the screen. Example, I click on the title of an article in a list, it shows all the article info on the right side of the list.

       

           <mx:List id="manageQueueList" 
                dataProvider="{queue}" 
                width="400" height="100%" 
                dragEnabled="false" 
                click="rateAndArchive(event)">
                <mx:itemRenderer>
                          <mx:Component>
                              <mx:VBox verticalGap="0" horizontalScrollPolicy="off" verticalScrollPolicy="off">
                          <mx:Text id="titleText" text="{data.itemTitle}"  fontSize="14"/>
                          <mx:HBox>
                               <mx:Text id="source" text="{data.itemSource}"/>
                               <mx:Text id="date" text="{data.itemDate}"/>
                          </mx:HBox>
                     </mx:VBox>
                          </mx:Component>
            </mx:itemRenderer>
           </mx:List>
      

       

                     [Bindable] public var queue:ArrayCollection;
                     private var _item:QueueItemVO;
                     private var _itemContainer:QueueItemView;
                     
                     private var _archiveEvent:ArchiveEvent;
                     
                     private function rateAndArchive(e:MouseEvent):void {
                          //_item = List(e.target).selectedItem;
                          //trace( List(e.target).selectedItem );
                          trace(e.target.toString());
                     }