PDA

View Full Version : Context menu hides when i click combo scroll .How to avoid this issue.?



vinodpadmanaban@gmail.com
18 Feb 2011, 10:58 AM
Hi ,
I have added menu as context-menu in a grid, in that i have added combo as an item,when i click scroll of the combo,the menu is hiding, how can i avoid this problem.
for your reference, i have done sample code with static data, pls look on it and provide solution..:-/

**************


Ext.onReady(function() {

Ext.QuickTips.init();
var arrayData = [
['J', 'MD'],
['A', 'VA'],
['S', 'DC'],
['M', 'DE'],
['B', 'NJ'],
['N', 'CA']
];

var store = new Ext.data.ArrayStore({
data : arrayData,
fields : ['fullName', 'state']
});

var cm = new Ext.grid.ColumnModel([
{
header : 'Full Name',
sortable : true,
dataIndex : 'fullName'
},
{
header : 'State',
dataIndex : 'state'
}
]);

var gridView = new Ext.grid.GridView();
var selModel = new Ext.grid.RowSelectionModel({
singleSelect : true
})

var grid = new Ext.grid.GridPanel({
title : 'Our first grid',
renderTo : Ext.getBody(),
autoHeight : true,
width : 250,
store : store,
view : gridView,
colModel : cm,
selModel : selModel
});
var ctxMenu = new Ext.menu.Menu({
items: [
{text: 'Item1'},
{
xtype: 'combo',
autoScroll : true,
name: 'value',
fieldLabel: 'Value',
mode: 'local',
store: new Ext.data.SimpleStore({
fields: ['id', 'value'],
data : [['1','A'],['2','B'],['3','C'],['1','A'],['2','B'],['3','C'],['1','A'],['2','B'],['3','C'],['1','A'],['2','B'],['3','C'],['1','A'],['2','B'],['3','C'],['1','A'],['2','B'],['3','C'],['1','A'],['2','B'],['3','C'],['1','A'],['2','B'],['3','C'],['1','A'],['2','B'],['3','C']]
}),
displayField:'value',
width: 130,
listeners: {
select: function(f,r,i){
Ext.Msg.alert('Title',i);
}
}
}
]
});
grid.on('rowcontextmenu', function(grid, rowIndex, event){
ctxMenu.showAt(event.getXY());
event.preventDefault();
});


});




**************
Thanks In advance

arthurakay
18 Feb 2011, 1:47 PM
First, be sure to use the CODE tags (# in the WYSIWYG) when posting code... easier to read that way.

Have you tried using the "ignoreParentClicks" config for your Ext.menu.Menu()? I don't know for sure if that will work, but it's worth a shot.

vinodpadmanaban@gmail.com
19 Feb 2011, 10:29 AM
hi arthurakay, (http://www.sencha.com/forum/member.php?48511-arthurakay)http://www.sencha.com/forum/images/statusicon/user-offline.png, thnks for reply
i tried to edit the code as understandable but i cant,what is WYSIWYG ?
then the property also not working man, i am not identified any difference with that property.

Condor
21 Feb 2011, 8:14 AM
It's a bit of a hack, but you can configure the combobox with listClass:'x-menu'.