Hi,

I seem to be getting duplicate values being displayed in my combo box
component.  I am using Flex and CF.  The query returns two records and
ultimately the combo box gets populated, but it has two values

So I am getting

Project Name:
XO Project
XO Project

There are two records that part is right, but the text in the actual
drop down is duplicated.  The query is correct so its not an issue with
the sql and/or my cfc.  It seems like there is a problem in the loop or
something, I am not sure.

Here is the combo box code:

<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns="*"
     toolTip="List of Projects"
     labelField="projectName">

     <mx:Script>
     <![CDATA[
         import com.adobe.actors.ApplicationState;
         import com.adobe.actors.Project;
         import mx.collections.ArrayCollection;
         [Bindable]
         public var firstEntry:String = "All";

         public function selectProject( e:Project ) : void
         {
             var dp:ArrayCollection = dataProvider as ArrayCollection;
             for(var i:int=0; i < dp.length; i++) {
                 var test:Object = dp.getItemAt(i) as Project;
                 if( test.id == e.projectId ) {
                     selectedIndex = i;
                     break;
                 }
             }
         }



     ]]>
     </mx:Script>
     <mx:dataProvider>
             {ApplicationState.instance.listOfProjects}
     </mx:dataProvider>


</mx:ComboBox>

******

This is a snippet from my ApplicationState.as file

private var _listOfProjects:ArrayCollection;

[Bindable(event="projectsChanged")]

public function set listOfProjects( ac:ArrayCollection ) : void        {
     _listOfProjects = ac;
     var dummyProject:Project = new Project();
     dummyProject.projectId = "";
     dummyProject.projectName = "Select";

     _listOfProjects.addItemAt(dummyProject, 0 );
         dispatchEvent( new FlexEvent("projectsChanged") );
         }


         public function get listOfProjects() : ArrayCollection        {
             return _listOfProjects;
         }



Reply via email to