4 Replies Latest reply on Mar 21, 2010 1:28 PM by akost01

    How do I prevent scroll in datagrid?

    akost01

      Hi!

       

      I have a problem when dragging items between two datagrids. If you try the code below you will find that whenever you drag items between the top left grid and the the bottom left grid, the bottom left grid will scroll even if the scrollbar is in "the middle". If you drag items between the top left grid and the top right grid there is no sroll.

       

      I do not what the grid to scroll when I drag items to it. Any suggestion how to solve this?

       

      Thanks in advance.

       

      Code

      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
              layout="vertical"
              verticalAlign="middle"
              backgroundColor="white">

      <mx:Array id="arr">
              <mx:Object colA="Item A.0" colB="Item B.0" colC="Item C.0" />
              <mx:Object colA="Item A.1" colB="Item B.1" colC="Item C.1" />
              <mx:Object colA="Item A.2" colB="Item B.2" colC="Item C.2" />
              <mx:Object colA="Item A.3" colB="Item B.3" colC="Item C.3" />
              <mx:Object colA="Item A.4" colB="Item B.4" colC="Item C.4" />
              <mx:Object colA="Item A.5" colB="Item B.5" colC="Item C.5" />
              <mx:Object colA="Item A.6" colB="Item B.6" colC="Item C.6" />
              <mx:Object colA="Item A.7" colB="Item B.7" colC="Item C.7" />
              <mx:Object colA="Item A.8" colB="Item B.8" colC="Item C.8" />
              <mx:Object colA="Item A.9" colB="Item B.9" colC="Item C.9" />
          </mx:Array>

          <mx:VBox>
        <mx:HBox>
         <mx:DataGrid id="dataGrid1"
           width="100%"
           rowHeight="22"
           dataProvider="{arr}"
           dragEnabled="true"
           allowMultipleSelection="true"
           dropEnabled="true"
           verticalScrollPolicy="on">
          <mx:columns>
           <mx:DataGridColumn dataField="colA" headerText="Column A" />
           <mx:DataGridColumn dataField="colB" headerText="Column B" />
           <mx:DataGridColumn dataField="colC" headerText="Column C" />
          </mx:columns>
         </mx:DataGrid>
          <mx:DataGrid id="dataGrid2"
           width="100%"
           rowHeight="22"
           dataProvider="{arr}"
           dragEnabled="true"
           dragMoveEnabled="true"
           dropEnabled="true">
          <mx:columns>
           <mx:DataGridColumn dataField="colA" headerText="Column A" />
           <mx:DataGridColumn dataField="colB" headerText="Column B" />
           <mx:DataGridColumn dataField="colC" headerText="Column C" />
          </mx:columns>
         </mx:DataGrid>
        </mx:HBox>
        <mx:HBox>
         <mx:DataGrid id="dataGrid3"
           width="100%"
           rowHeight="22"
           dataProvider="{arr}"
           dragEnabled="true"
           allowMultipleSelection="true"
           dropEnabled="true"
           verticalScrollPolicy="on">
          <mx:columns>
           <mx:DataGridColumn dataField="colA" headerText="Column A" />
           <mx:DataGridColumn dataField="colB" headerText="Column B" />
           <mx:DataGridColumn dataField="colC" headerText="Column C" />
          </mx:columns>
         </mx:DataGrid>
          <mx:DataGrid id="dataGrid4"
           width="100%"
           rowHeight="22"
           dataProvider="{arr}"
           dragEnabled="true"
           dragMoveEnabled="true"
           dropEnabled="true">
          <mx:columns>
           <mx:DataGridColumn dataField="colA" headerText="Column A" />
           <mx:DataGridColumn dataField="colB" headerText="Column B" />
           <mx:DataGridColumn dataField="colC" headerText="Column C" />
          </mx:columns>
         </mx:DataGrid>
        </mx:HBox>
      </mx:VBox>

      </mx:WindowedApplication>