Extgrid add right-click menu _ YUI. Ext

Source: Internet
Author: User
Extgrid add and right-click the menu implementation code. The Code is as follows:


Grid. addListener ('rowcontextmenu ', rightClickFn); // key part of the context menu code
// Create Menu
Var rightClick = new Ext. menu. Menu ({
Id: 'rightclickcont', // The HTML file must contain a rightClickCont DIV element.
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 click ');
}
Function rMenu2Fn (){
Ext. MessageBox. alert ('right', 'right-click menu 2 click ');
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.