Flex ItemRenderer/Editor ComboBox Issue...Puhleezz Help

Posted by Mohit on Stack Overflow See other posts from Stack Overflow or by Mohit
Published on 2010-05-06T11:40:00Z Indexed on 2010/05/06 20:18 UTC
Read the original article Hit count: 341

Filed under:
|
|
|

Hi EveryOne

Beginner in Flex ...Even worse with item renderers... Have managed to add a Combobox to a datagrid using a itemEditor... I want to change the options in a combo box depending on the value selected by the user on a previous combo..

  1. In the combo box i want to display a certain value (Model Name ) but for quering a table i'll pass the corresponding code of the model :(... sounds simple enough ..unfortunately not able to implement it

I have found this problem on this site but the solution seems an overkill for my "small" problem..was hoping if anyone could guide me towards a more simpler solution...

My xml comes as

<item><mstValue>CH1</mstValue><mstRemarks>CARRIER</mstRemarks></item>
<item><mstValue>CH2</mstValue><mstRemarks>TRANS</mstRemarks></item>
<item><mstValue>CH3</mstValue><mstRemarks>YORK</mstRemarks></item>

Now i have been able to show the values in a combo .if user selects CARRIER i want to pass CH1(dont know how to do it with itemeditors)...and then fetch values corresponding to CH1 from a table (second part of the problem)...in the sample below i used

this.parentDocument.modelComboChanged(this.selectedItem) to pass the selected value ...instedd i need to pass the code for it which comes from the xml...Pls help this making me go crazy....

<mx:DataGrid id="chillerGrid" dataProvider="{chillerGridDp}" editable="true" itemRollOver="{ComponentUtil.setTooltip(event,this)}" itemRollOut="ComponentUtil.resetTooltip(event)" width="70%" height="160">
   <mx:columns>

   <mx:DataGridColumn id="test" headerText="Model" dataField="model" editorDataField="value" editable="true" backgroundColor="#f4f2bd" width="100"  >
   <mx:itemEditor>    
    <mx:Component>     
     <mx:ComboBox  creationComplete="{if(text=='')selectedIndex=0;if(data &amp;&amp; data.contactType!=undefined)text=data.contactType.text();}"  change="{if(text == ''){selectedIndex=0;if(data &amp;&amp; data.contactType!=undefined)text=data.contactType.text();};this.parentDocument.modelComboChanged(this.selectedItem)}" dataProvider="{this.parentDocument.arrColl1}" text="mstRemarks" labelField="mstRemarks" editable = "false"   >
     <!--<mx:dataProvider > 
      <mx:String></mx:String>         
      <mx:String>Model1</mx:String>
      <mx:String>Model2</mx:String>
      <mx:String>Model3</mx:String>
      <mx:String>Model4</mx:String>                   
      <mx:String>Model5</mx:String>

     </mx:dataProvider>-->       
     </mx:ComboBox>   
     <!--<components:ComboBoxIn  dataProvider="{this.parentDocument.arrColl1}" labelField="mstRemarks"  /> -->   
    </mx:Component>
   </mx:itemEditor>
 </mx:DataGridColumn> 

  <mx:DataGridColumn headerText="Make" dataField="make" editorDataField="value" editable="true" backgroundColor="#f4f2bd" width="100"  >
   <mx:itemEditor>    
    <mx:Component>     
     <mx:ComboBox creationComplete="{if(text=='')selectedIndex=0;if(data &amp;&amp; data.contactType!=undefined)text=data.contactType.text();}"  change="{if(text == ''){selectedIndex=0;if(data &amp;&amp; data.contactType!=undefined)text=data.contactType.text();} }" labelField="@label" editable = "false"   >
     <mx:dataProvider> 
      <mx:String></mx:String>         
      <mx:String>Carrier</mx:String>
      <mx:String>York</mx:String>
      <mx:String>Trane</mx:String>
     </mx:dataProvider>        
     </mx:ComboBox>        
    </mx:Component>
   </mx:itemEditor>
  </mx:DataGridColumn> 

    <mx:DataGridColumn headerText="Chillers" dataField="chillers" width="200" editable="true">
   <mx:itemEditor>
    <mx:Component>
     <mx:TextInput maxChars="49" />
    </mx:Component>
   </mx:itemEditor>
  </mx:DataGridColumn> 

   </mx:columns>
   </mx:DataGrid>

© Stack Overflow or respective owner

Related posts about flex

Related posts about combobox