1 Reply Latest reply on Nov 24, 2008 8:02 PM by Newsgroup_User

    Combobox with XML

    Level 1

      Hi All,
      here i have a problem with Comobobox with XML.

      My problem is "I have two comboboxes and one XML file".What ever data is there in the XML file that data i'm getting and put it in both comboboxes but for one combobox i want to add one element explicitly .

      Can u tel me how to do that.........
      this is my XML file..

      <?xml version="1.0" encoding="UTF-8"?>
      <CategoryList>
      <CategoryListitems>
      <category>Home</category>
      </CategoryListitems>
      <CategoryListitems>
      <category>Sports</category>
      </CategoryListitems>
      <CategoryListitems>
      <category>office</category>
      </CategoryListitems>
      </CategoryList>

      Explicitly i want add the "All" element for one combobox.
      this is my MXML file....

      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="getCategory.send();">
      <mx:Script>
      <![CDATA[

      [Bindable]
      public var categoryList:ArrayCollection;

      [Bindable]
      public var filterList:ArrayCollection;

      private function categoryResult():void
      {
      categoryList = getCategory.lastResult.CategoryList.CategoryListitems;
      deltaskcategory.dataProvider = categoryList;
      //Alert.show("Category list data "+ categoryList);
      deltaskcategory.selectedIndex = -1;

      filterList = getCategory.lastResult.CategoryList.CategoryListitems;
      //Alert.show("filterlist list data "+ filterList);
      filterList.addItemAt(({categoryname:'All'}),0);
      categoryGroup.dataProvider = filterList;
      }

      <mx:HTTPService id="getCategory" url="combo.xml" result="categoryResult(); />
      <mx:ComboBox id="categoryGroup" width="100" labelField="category"/>
      <mx:ComboBox id="deltaskcategory" width="160" labelField="category"/>
      </mx:Application>