PDA

View Full Version : Menu with right mouse click and use data from grid



blade226
5 Jun 2014, 4:27 AM
Hello,

i made a grid from a store and a menu with a right mouse click.

Now i want to to do a right-click on a row of the grid, the menu opens and the data (for example the id) of the row must be imported in the handler



var artikelGrid = Ext.create('Ext.grid.Panel', {
store: mystore_massnahmen,
columns: [ {header:"ID",dataIndex:"fuid_massnahme",flex:0,hidden:false},
{header:"Titel",dataIndex:"titel",flex:1},
{header:"Beschreibung",dataIndex:"beschreibung",flex:1},
{header:"Von",dataIndex:"von",flex:1},
{header:"Bis",dataIndex:"bis",flex:2}
],
listeners : {
itemcontextmenu : function(record, item, index, e, eOpts){
var xy = eOpts.getXY();
new Ext.menu.Menu({
items : [{
text : 'Ansehen',iconCls: 'employee-lupe'
}, {
text : 'Neuer Datensatz',iconCls: 'employee-add',handler: function() {}
}, {
text : 'Bearbeiten',iconCls: 'employee-edit',handler: function() {
var rec = mystore_massnahmen.getAt(index);


alert("Bearbeiten " + rec.get('fuid_massnahme'));

}
}, {
text : 'Eintrag löschen',iconCls: 'employee-remove'
}, {
text : 'Eintrag deaktivieren',iconCls: 'employee-deaktivieren'
}, {
text : 'Eintrag aktivieren',iconCls: 'employee-aktivieren'
}]
}).showAt(xy)
}},
width: 790,
height: 500,
title: 'Maßnahmenübersicht',
frame: true,
}
);

Really nice, when somebody can help me!

Greetz
Sascha

mdnaveed42
9 Jun 2014, 4:56 AM
Hi,

Created a Fiddle for you (https://fiddle.sencha.com/#fiddle/6g7).

For more details, Check this link..

http://www.sencha.com/forum/showthread.php?265766-mouse-right-click-on-grid-row-display-menu


Thanks,
Md Naveed
\m/