2
我可怎麼辦DataGrid中鼠標右鍵後點擊鼠標下實際的項目將選擇(同鼠標左鍵點擊)
感謝您的幫助數據網格選擇
我可怎麼辦DataGrid中鼠標右鍵後點擊鼠標下實際的項目將選擇(同鼠標左鍵點擊)
感謝您的幫助數據網格選擇
我建議您延長DataGrid
和引進有一個新的領域:
public var currentOverItem:Object;
然後在您的自定義DataGrid
覆蓋mouseOverHandler()
方式如下:
override protected function mouseOverHandler(event:MouseEvent):void
{
super.mouseOverHandler(event);
var item:IListItemRenderer = mouseEventToItemRenderer(event);
if (item)
{
currentOverItem = item.data;
}
else
{
currentOverItem = null;
}
}
使用這個DataGrid非常簡單。只要訂閱ContextMenuEvent.MENU_SELECT
事件自定義DataGrid
的實例,並在上下文菜單的處理程序使用下面的代碼:
myGrid.selectedItem = myGrid.currentOverItem;
希望這有助於!
我找到事件爲itemRollOver所以我讓處理機 >保護的函數myGrid_itemRollOverHandler(事件:的ListEvent):無效 { event.target.selectedIndex = event.rowIndex; } – 2011-04-21 11:46:19
是的,它會工作。我剛剛提供封裝的解決方案:) – Constantiner 2011-04-21 12:03:46