4 Replies Latest reply on Jun 21, 2007 8:14 AM by beLeh

    Strange text in the DataGrid columns

    beLeh
      Hi,

      I have the following problem:
      When I specify itemRenderer for my DataGrid, I am getting strange text overlapping the expected column header for column 1. the itemRenderer for the purpose of debugging is very simple: i just need text to be of the different color from my other grid. The and the grid delcaration are bellow, any help is appreciated.

      package
      {
      import mx.controls.dataGridClasses.DataGridItemRenderer;
      import flash.events.Event;
      import mx.controls.DataGrid;
      import mx.controls.dataGridClasses.DataGridItemRenderer;
      import mx.controls.dataGridClasses.DataGridListData;
      import mx.collections.ArrayCollection;

      public class BoldItemGridRenderer extends DataGridItemRenderer
      {
      public function BoldItemGridRenderer()
      {
      super();
      }

      override public function set data(value:Object):void
      {
      super.data = value;
      super.visible = true;
      setStyle("color", 0xff0000);
      }
      }
      }
      ------------------------------------------------------
      <mx:Panel width="100%" height="100%" title="Work Log" backgroundColor="#99CCFF" id="canvasWorkLog">
      <mx:DataGrid width="{canvasWorkLog.width - 20}" height="100%" id="gd_WorkBlotter"
      dataProvider="{workBlotterDP}" editable="true" horizontalScrollPolicy="auto"
      contextMenu="{onContextMenu('WorkBlotterGrid')}" themeColor="#D0EE5B" itemRenderer="BoldItemGridRenderer">
      <mx:columns>
      .
      .
      .
      .
      .
      </mx:DataGrid>
        • 1. Re: Strange text in the DataGrid columns
          ntsiii Level 3
          I don't know what this could be. Can you reproduce it in a simple runnable example?

          Also, there is a "hotfix 2" available that fixes some dataGrid problems.

          Tracy
          • 2. Re: Strange text in the DataGrid columns
            beLeh Level 1
            Could you please suggest where can i get this "hotfix 2"? I download trial Builder less then a week ago. Is this included?

            Thanks a lot,
            • 3. Re: Strange text in the DataGrid columns
              beLeh Level 1
              The following example reproduces the problem:

              File test2.mxml:
              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
              <mx:DataGrid id="dg" width="100%" height="100%" rowCount="5" dataProvider="{employees}" editable="true" itemRenderer="testRender" >
              <mx:columns>
              <mx:DataGridColumn dataField="name" headerText="Name"/>
              <mx:DataGridColumn dataField="phone" headerText="Phone" editable="false"/>
              <mx:DataGridColumn dataField="email" headerText="Email" editable="true"/>
              </mx:columns>
              </mx:DataGrid>

              <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:Script>
              <![CDATA[
              ]]>
              </mx:Script>
              </mx:Application>

              ==============================

              File testRenderer.as

              // ActionScript file
              package
              {
              import mx.controls.dataGridClasses.DataGridItemRenderer;
              import flash.events.Event;
              import mx.controls.DataGrid;
              import mx.controls.dataGridClasses.DataGridItemRenderer;
              import mx.controls.dataGridClasses.DataGridListData;
              import mx.collections.ArrayCollection;

              public class testRender extends DataGridItemRenderer
              {
              public function testRender()
              {
              super();
              }

              override public function set data(value:Object):void
              {
              super.data = value;
              super.visible = true;
              setStyle("color", 0xff0000);
              }
              }
              }

              thanks a lot,

              • 4. Re: Strange text in the DataGrid columns
                beLeh Level 1
                Anyone?