0 Replies Latest reply on May 20, 2008 1:45 AM by sulletf

    DataGrid fontWeight style behave strange

    sulletf
      Hi!

      See the below example and update column 1 from "undefined" to "bold" then to "normal" : only the header is set to "normal" fontWeight. If you click on "clear" for the dataGrid, then column1 has its fontWeight set to "normal" !

      Is it only strange to me ?

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="init()">

      <mx:Script>
      <![CDATA[

      private function init(): void {
      dgRBG.selectedValue=String(dg.getStyle('fontWeight'));
      dgc1RBG.selectedValue=String(dgc1.getStyle('fontWeight'));
      dgc2RBG.selectedValue=String(dgc2.getStyle('fontWeight'));
      dgc3RBG.selectedValue=String(dgc3.getStyle('fontWeight'));
      }

      private function clearFontWeightDG(): void {
      dg.clearStyle('fontWeight');

      callLater( init );
      }
      private function clearFontWeight1(): void {
      dgc1.clearStyle('fontWeight');

      callLater( init );
      }
      private function clearFontWeight2(): void {
      dgc2.clearStyle('fontWeight');

      callLater( init );
      }
      private function clearFontWeight3(): void {
      dgc3.clearStyle('fontWeight');

      callLater( init );
      }

      ]]>
      </mx:Script>

      <mx:XMLList id="employees">
      <employee>
      <name>Christina Coenraets</name>
      <phone>555-219-2270</phone>
      <email>ccoenraets@fictitious.com</email>
      <active>true</active>
      </employee>
      <employee>
      <name>Joanne Wall</name>
      <phone>555-219-2012</phone>
      <email>jwall@fictitious.com</email>
      <active>true</active>
      </employee>
      <employee>
      <name>Maurice Smith</name>
      <phone>555-219-2012</phone>
      <email>maurice@fictitious.com</email>
      <active>false</active>
      </employee>
      <employee>
      <name>Mary Jones</name>
      <phone>555-219-2000</phone>
      <email>mjones@fictitious.com</email>
      <active>true</active>
      </employee>
      </mx:XMLList>

      <mx:DataGrid id="dg" rowCount="5" dataProvider="{employees}">
      <mx:columns>
      <mx:DataGridColumn id="dgc1" dataField="name" headerText="Name" />
      <mx:DataGridColumn id="dgc2" dataField="phone" headerText="Phone"/>
      <mx:DataGridColumn id="dgc3" dataField="email" headerText="Email"/>
      </mx:columns>
      </mx:DataGrid>

      <mx:Form>
      <mx:FormItem label="datagrid" direction="horizontal">
      <mx:RadioButtonGroup id="dgRBG" itemClick="dg.setStyle('fontWeight', dgRBG.selectedValue);" />
      <mx:RadioButton groupName="dgRBG" label="normal" value="normal" />
      <mx:RadioButton groupName="dgRBG" label="bold" value="bold" />
      <mx:RadioButton groupName="dgRBG" label="undefined" value="undefined" />
      <mx:Button label="clear" click="clearFontWeightDG()" />
      </mx:FormItem>
      <mx:FormItem label="column 1" direction="horizontal">
      <mx:RadioButtonGroup id="dgc1RBG" itemClick="dgc1.setStyle('fontWeight', dgc1RBG.selectedValue);" />
      <mx:RadioButton groupName="dgc1RBG" label="normal" value="normal" />
      <mx:RadioButton groupName="dgc1RBG" label="bold" value="bold" />
      <mx:RadioButton groupName="dgc1RBG" label="undefined" value="undefined" />
      <mx:Button label="clear" click="clearFontWeight1()" />
      </mx:FormItem>
      <mx:FormItem label="column 2" direction="horizontal">
      <mx:RadioButtonGroup id="dgc2RBG" itemClick="dgc2.setStyle('fontWeight', dgc2RBG.selectedValue);" />
      <mx:RadioButton groupName="dgc2RBG" label="normal" value="normal" />
      <mx:RadioButton groupName="dgc2RBG" label="bold" value="bold" />
      <mx:RadioButton groupName="dgc2RBG" label="undefined" value="undefined" />
      <mx:Button label="clear" click="clearFontWeight2()" />
      </mx:FormItem>
      <mx:FormItem label="column 3" direction="horizontal">
      <mx:RadioButtonGroup id="dgc3RBG" itemClick="dgc3.setStyle('fontWeight', dgc3RBG.selectedValue);" />
      <mx:RadioButton groupName="dgc3RBG" label="normal" value="normal" />
      <mx:RadioButton groupName="dgc3RBG" label="bold" value="bold" />
      <mx:RadioButton groupName="dgc3RBG" label="undefined" value="undefined" />
      <mx:Button label="clear" click="clearFontWeight3()" />
      </mx:FormItem>
      </mx:Form>

      </mx:Application>