1 Reply Latest reply on Mar 31, 2008 9:58 PM by sameerb

    combobox as itemrenderer in advanceddatadrid

    MyNickSG
      I am trying to bind combobox column in datagrid. when i provide dataprovider statically in datagrid, its working fine..

      here is d code for static combobox binding:

      <mx:DataGridColumn dataField="Column" editable="false">
      <mx:itemRenderer>
      <mx:Component>
      <mx:ComboBox>
      <mx:dataProvider>
      <mx:String></mx:String>
      <mx:String>First Name</mx:String>
      <mx:String>Last Name</mx:String>
      <mx:String>City</mx:String>
      <mx:String>State</mx:String>
      <mx:String>Zip</mx:String>
      </mx:dataProvider>
      </mx:ComboBox>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>


      however if i try binding the same combobox column using some array(d data returned by web service or some array collection), its giving an error(object array not defined)

      here are the methods i have tried for dynamic binding, both methods are not working:

      Method1:
      <mx:XMLList id="statesXMLList">
      <state abbrev="AL" name="Alabama" />
      <state abbrev="AK" name="Alaska" />
      <state abbrev="AZ" name="Arizona" />
      <state abbrev="AR" name="Arkansas" />
      <state abbrev="CA" name="California" />
      <state abbrev="CO" name="Colorado" />
      <state abbrev="CT" name="Connecticut" />
      </mx:XMLList>

      <mx:Component id="inlineEditor">
      <mx:ComboBox dataProvider="{statesXMLList}"
      rowCount="3"
      labelField="@name">
      </mx:ComboBox>
      </mx:Component>

      Error: statesXMLList not defined


      Method 2:

      <mx:AdvancedDataGridColumn dataField="Column" editable="false">
      <mx:itemRenderer>
      <mx:Component>
      <mx:ComboBox itemRenderer="{SegmentCombo}">
      </mx:ComboBox>
      </mx:Component>
      </mx:itemRenderer>
      </mx:AdvancedDataGridColumn>

      If i create new custom component, its wrking fine. i dont want to use custom component, is there any other way to render combobox.?? Please help me out..

      Thanks in Advance