Home  >  Article  >  Web Front-end  >  Ext grid adds right-click menu_YUI.Ext related

Ext grid adds right-click menu_YUI.Ext related

WBOY
WBOYOriginal
2016-05-16 18:41:041157browse
Copy code The code is as follows:

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