开发者

data grid selection

how can i do in DataGrid after mouse right button click actual item under mouse will select (same as mous开发者_运维百科e left button click)

thanks for help


I recommend you to extend your DataGrid and introduce there a new field:

public var currentOverItem:Object;

Then override mouseOverHandler() in your custom DataGrid the following way:

    override protected function mouseOverHandler(event:MouseEvent):void
    {
        super.mouseOverHandler(event);
        var item:IListItemRenderer = mouseEventToItemRenderer(event);
        if (item)
        {
            currentOverItem = item.data;
        }
        else
        {
            currentOverItem = null;
        }
    }

Using of this DataGrid is pretty simple. Just subscribe ContextMenuEvent.MENU_SELECT event of the instance of your custom DataGrid and use the following code in context menu handler:

            myGrid.selectedItem = myGrid.currentOverItem;

Hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜