2010-12-15 20 views

回答

2

我不相信你可以直接做到這一點,沒有擴展datagrid,因爲我不相信有任何方法可以直接訪問標題。幸運的是,我們可以獲得標題的高度,並可以將其與鼠標位置進行比較以手動更改光標。下面是在FLEX4一個完整的例子:

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" 
       applicationComplete="init()" 
       > 
    <fx:Script> 
     <![CDATA[ 
      import flash.events.MouseEvent; 
     private function init():void{ 
      this.grid.addEventListener(MouseEvent.MOUSE_MOVE, function():void{ 
       if (grid.contentMouseY <= grid.headerHeight) { 
        useHandCursor = true 
        buttonMode = true 
       } else { 
        useHandCursor = false 
        buttonMode = false 
       } 
      }) 
      this.grid.addEventListener(MouseEvent.MOUSE_OUT, function():void { 
       useHandCursor = false 
       buttonMode = false 
      }) 
     } 
     ]]> 
    </fx:Script> 
    <mx:DataGrid id="grid"/> 
</s:Application> 

這裏的創建/延伸flex3分量(因爲它的一個MX成分)閃光燈DOC:http://livedocs.adobe.com/flex/3/html/help.html?content=Part4_CreateComps_1.html

相關問題