右健123

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);

}

你可能感兴趣的:(ext)