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' );
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn