0 Replies Latest reply on Jan 4, 2010 11:44 PM by megharajdeepak

    How to change cell color based on item selected in dropdown itemEditor of same data grid?

    megharajdeepak Level 1

      Hi there,

       

      I have a datagrid with 3 columns, col1, col2 and col3. col1 has drop down as the itemeditor, which has three values, A, B and C. Based on this value selected, I want to color the cell of either col2 or col3. If A is selected I need to color the col2 cell, if B or C is selected, I need to color col3 cell. I had been trying few things, but no luck Is it possible to achieve something like this in first place? if yes, please help me with your expertise.

       

      Here's the code so far:

       

      <mx:DataGridColumn id="dcCol1" headerText="Payment Type" dataField="col1">
                          <mx:itemEditor>
                              <mx:Component>
                                  <mx:ComboBox>
                                      <mx:dataProvider>
                                          <mx:String></mx:String>
                                          <mx:String>A</mx:String>
                                          <mx:String>B</mx:String>
                                          <mx:String>C</mx:String>
                                      </mx:dataProvider>
                                     
                                      <mx:change>
                                          <![CDATA[
                                              switch(this.selectedItem){
                                                 
                                                  case "A":
                                                      // i tried to use outerDocument property to set the itemrender of the datacolumns here, but i get some runtime error

                                   
                                                  break;
                                                 
                                                  case "B":
                                                 
                                                  break;
                                                 
                                                  case "C":
                                                
                                                  break;
                                              }
                                          ]]>
                                      </mx:change>
                                    
                                  </mx:ComboBox>
                             
                                 
                              </mx:Component>
                             
                             
                          </mx:itemEditor>
                      </mx:DataGridColumn>
                     
                     
                      <mx:DataGridColumn id="dcCol2" headerText="Amount" dataField="col2" textAlign="right"/>
                      <mx:DataGridColumn id="dcCol3" headerText="Issuing Bank" dataField="col3"/>