1 Reply Latest reply on Feb 3, 2010 5:39 AM by archemedia

    background color for selected rows and colums in AdvanceDatagrid

    Lotus_kannan

      I want to apply background color for selected rows and columns in AdvanceDatagrid from colorpicker event .After selecting the color from colorpicker  color  should apply the rows and columns of advancedatagrid.Please help this.....

        • 1. Re: background color for selected rows and colums in AdvanceDatagrid
          archemedia Level 4

          This should do the trick:

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" layout="vertical" xmlns:components="components.*">
              <mx:Script>
                  <![CDATA[
                      import mx.collections.ArrayCollection;
                     
                      [Bindable]
                      private var dp:ArrayCollection = new ArrayCollection();
                      [Bindable]
                      private var selColor:uint;
                     
                      private function init():void
                      {
                          var a:Array = ["a", "b", "c", "d", "e", "f"];
                          dp.source = a;
                          selColor = cp.selectedColor;
                      }
                     
                      private function handleChange(evt:Event):void
                      {
                          selColor = evt.target.selectedColor;
                      }
                  ]]>
              </mx:Script>
              <mx:AdvancedDataGrid id="adg1" selectionColor="{selColor}" designViewDataType="flat" dataProvider="{dp}" selectionMode="multipleRows">
                  <mx:columns>
                      <mx:AdvancedDataGridColumn headerText="Column 1"/>
                  </mx:columns>
              </mx:AdvancedDataGrid>
             
              <mx:ColorPicker id="cp" change="handleChange(event)"/>

           

          </mx:Application>

           

           

          Dany