1 Reply Latest reply on Nov 4, 2007 8:55 AM by ntsiii

    Scrolling DataGrid

    Alberto_Mz
      Hi!

      I have a DataGrid with 8 columns but only 3 columns are visible so
      i set the DataGrid horizontalScrollPolicy property ="on" to scroll the DataGrid and be able to see the rest of the columns.
      When i press the scroll bar buttons or move the scroll bar the DataGrid shows only complete columns, is it possible to show just a part of the column when scrolling the DataGrid ?

      This is because when i scroll the DataGrid i want to scroll a panel with the same distance.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" >

      <mx:Script>
      <![CDATA[
      import flash.events.Event;
      import mx.events.ScrollEvent;
      import mx.events.ScrollEventDirection;
      import mx.controls.scrollClasses.ScrollBar;

      private function Scrolling(eventScroll:ScrollEvent):void
      {
      var hScroll:ScrollBar = pnl_Edits.horizontalScrollBar;

      if (eventScroll.direction == ScrollEventDirection.HORIZONTAL)
      {
      hScroll.scrollPosition = eventScroll.position;
      }
      }
      ]]>
      </mx:Script>

      <mx:DataGrid id="dataGrid"
      scroll="Scrolling(event);"
      horizontalScrollPolicy="on"
      width="300" x="142" y="460" >
      <mx:columns>
      <mx:DataGridColumn dataField="@name" headerText="Name:" width="150" />
      <mx:DataGridColumn dataField="@colA" headerText="Column A:" />
      <mx:DataGridColumn dataField="@colB" headerText="Column B:" />
      <mx:DataGridColumn dataField="@colC" headerText="Column C:" />
      <mx:DataGridColumn dataField="@colD" headerText="Column D:" />
      <mx:DataGridColumn dataField="@colE" headerText="Column E:" />
      <mx:DataGridColumn dataField="@colF" headerText="Column F:" />
      </mx:columns>

      </mx:DataGrid>

      <mx:Panel x="129" y="359" width="313" height="93" layout="absolute" borderStyle="solid" horizontalScrollPolicy="on" id="pnl_Edits">
      <mx:TextInput x="0" y="0" width="140"/>
      <mx:TextInput x="138" y="0" width="103"/>
      <mx:TextInput x="240" y="0" width="103"/>
      <mx:TextInput x="341" y="0" width="103"/>
      <mx:TextInput x="443" y="0" width="103"/>
      <mx:TextInput x="545" y="0" width="103"/>
      <mx:TextInput x="646" y="0" width="103"/>

      </mx:Panel>


      </mx:Application>