PDA

View Full Version : Context menu showing on window instead of grid on 4.2.0



oturkan
11 May 2013, 1:18 AM
I have grid on window. I add context menu to grid. But context menu showing under grid



Ext.define('Ext.ux.desktop.Grid', {
extend: 'Ext.grid.Panel',


requires: [
'Ext.ux.desktop.SearchField',
'Ext.toolbar.Paging'
],


width: '100%',


height: '100%',


stripeRows: true,

listeners: {
itemcontextmenu: function (view, record, item, index, e) {
e.stopEvent();
var selModel = this.getSelectionModel();
if (selModel instanceof Ext.selection.RowModel) {
if (!selModel.isSelected(record)) {
selModel.select(record);
}
this.fireEvent('itemclick', this, record, item, index, e);
this.contextMenu.showAt(e.getXY());
}
}
},


initComponent: function () {
var me = this;
me.contextMenu = Ext.create('Ext.menu.Menu', { items: [{ text: 'O?uz' }, {text:'Türkan'}] });
....
}

slemmon
13 May 2013, 11:29 AM
The below example works ok for me. Are you seeing it work ok for you, too?


Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Lisa', "email":"[email protected]", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"[email protected]", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"[email protected]", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});


Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.getBody(),
myMenu: Ext.widget('menu', {
items: [{ text: 'First Menu Item' }]
}),
listeners: {
itemcontextmenu: function (view, record, item, index, e) {
e.stopEvent();
view.ownerCt.myMenu.showAt(e.getXY());
}
}
});

oturkan
14 May 2013, 2:04 AM
thank you it's works