extjs 右键菜单

js:
//右键菜单
grid.addListener('rowcontextmenu', rightClickFn);//右键菜单代码关键部分
var rightClick = new Ext.menu.Menu({
    id:'rightClickCont',
    items: [
        {
            //id: 'rMenu1',
            //handler: rMenu1Fn,
            text: '右键菜单1'
        },
        {
            //id: 'rMenu2',
            //handler: rMenu2Fn,
            text: '右键菜单2'
        }
    ]
});
//右键菜单代码关键部分
function rightClickFn(grid,rowindex,e){
    e.preventDefault();
    rightClick.showAt(e.getXY());
}
02、单击列表项实现
grid.addListener('rowclick', rowclickFn);
function rowclickFn(grid,rowindex,e){
    alert('单击 '+ rowindex);
}
03、双击列表项实现
grid.addListener('rowdblclick', rowdblclickFn);
function rowdblclickFn(grid,rowindex,e){
    alert('双击 '+ rowindex);

}

posted @ 2010-10-25 14:02  Jamie  阅读(4987)  评论(0编辑  收藏  举报