grid . addListener ( 'rowcontextmenu' , rightClickFn ); // Right-click menu Key part of the code
//Menu creation
var rightClick = new Ext . menu . Menu ({
id : 'rightClickCont' , // There must be a DIV element of rightClickCont in the HTML file
items : [{
id : 'rMenu1' ,
handler : rMenu1Fn , // Event triggered after clicking
text : 'Right-click menu 1'
}, {
id : 'rMenu2' ,
handler : rMenu2Fn ,
text : 'Right-click menu 2'
}]
});
function rightClickFn ( grid , rowindex , e ){
e . preventDefault () ;
rightClick . showAt ( e . getXY ());
}
function rMenu1Fn (){
Ext . MessageBox . alert ( 'right' , 'Right-click menu 1 was clicked' );
}
function rMenu2Fn (){
Ext . MessageBox . alert ( 'right' , 'Right-click menu 2 was clicked' );
}