-
1 Feb 2012 10:13 AM #1
Problem with context menu: it only shows once...
Problem with context menu: it only shows once...
Hi there,
I'm having a rather peculiar problem with a context menu. On my application every grid has a context menu that is shown when the user right clicks on an element of the grid. What happens is that if the menu has a lot of items and it's height is bigger than the available height of the browser window, the menu is only shown once.
If I right click and the menu is small it displays fine every time. But if the menu height is too big for the browser window, or if I resize the browser window and make it too small for the menu, it displays once (with scrolling enabled), but after that, every time I right click on an item, I just get an empty little box (looks like a menu with no items) instead of the full menu with all my items.
This is the way I'm displaying the menu when the user right clicks an item on the grid:
Code:viewConfig: { listeners: { itemcontextmenu: function (view, record, item, index, e, options) { e.stopEvent(); this.panel.selModel.select(index, true); if (this.panel.gridContextMenu) { this.panel.gridContextMenu.showAt(e.getXY()); } return false; } } },
And the gridContextMenu you see on the code above is a property I am creating on the initComponent method of the gridPanel, like this:
Code:this.gridContextMenu = Ext.create('Ext.menu.Menu', { items:[ Ext.create('Ext.Action', { text: 'Item 1' }), Ext.create('Ext.Action', { text: 'Item 2' }), Ext.create('Ext.Action', { text: 'Item 3' }), Ext.create('Ext.Action', { text: 'Item 4' }), Ext.create('Ext.Action', { text: 'Item 5' }), Ext.create('Ext.Action', { text: 'Item 6' }), Ext.create('Ext.Action', { text: 'Item 7' }), Ext.create('Ext.Action', { text: 'Item 8' }), Ext.create('Ext.Action', { text: 'Item 9' }), Ext.create('Ext.Action', { text: 'Item 10' }), Ext.create('Ext.Action', { text: 'Item 11' }), Ext.create('Ext.Action', { text: 'Item 12' }), Ext.create('Ext.Action', { text: 'Item 13' }), Ext.create('Ext.Action', { text: 'Item 14' }), Ext.create('Ext.Action', { text: 'Item 15' }), Ext.create('Ext.Action', { text: 'Item 16' }), Ext.create('Ext.Action', { text: 'Item 17' }), Ext.create('Ext.Action', { text: 'Item 18' }) ] });
Can anyone tell me what is the problem ? Am I doing something wrong ? Or is it a bug ?
Regards,
Joao Maia
-
1 Feb 2012 10:24 AM #2
It's a bug, or so it seems...
It's a bug, or so it seems...
Looks like it's a bug...
It also happens on Ext's samples:
http://dev.sencha.com/deploy/ext-4.0...tion-grid.html
Just try to resize the browser window on that example to a height that's too small for the context menu to appear fully. It needs to be really small as the sample's menu only has two items, but you'll get the exact same problem I'm having with mine.
Regards,
Joao Maia
-
1 Feb 2012 1:45 PM #3
Do you want this thread to be moved to Bugs?
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
2 Feb 2012 1:54 AM #4
Yes, please.
By the way, please tell me how I can get feedback on the threads that are moved to bugs.
Regards,
Joao Maia
-
2 Feb 2012 4:23 PM #5
They are in the hands of developers when in bugs. You can still post there and ask about the status.
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
2 Feb 2012 5:21 PM #6
There isn't enough information here:
1) What browsers is it happening on?
2) What release are you using?
3) Is there a test case?
4) Does it happen on the 4.1 b2?
Can't reproduce it on Chrome/FF using the following test case on 4.1b2:
Code:Ext.onReady(function() { var items = [], i = 0; for(; i < 100; ++i) { items.push({ text: 'Item ' + i }); } var menu = Ext.create('Ext.menu.Menu', { items: items }); Ext.create('Ext.grid.Panel', { width : 200, height : 200, renderTo : document.body, viewConfig : { listeners : { itemcontextmenu : function(view, record, node, index, e) { e.stopEvent(); menu.showAt(e.getXY()); } } }, store : { fields : ['a'], data : [{ a : 1 }, { a : 2 }] }, columns : [{ dataIndex : 'a', header : 'A' }] }); });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
3 Feb 2012 2:38 AM #7
1) IE 8 and 9, Google Chrome (latest release), Firefox 9.0.1 on Windows 7 system. I have not tried out on other systems.
2) 4.0.7
3) For a test case you can use your own sample at the url below, because the problem is also happening there.
http://dev.sencha.com/deploy/ext-4.0...tion-grid.html
Check out the screenshot below from Chrome. It's a shot of the problem happening with your sample. As you can see the context menu has nothing, just the scroll arrows but no items. It does not happen the FIRST time I right click. It happens when the window is too small, I right click the FIRST time and it gets displayed ok, but on SUBSEQUENT right clicks the problem happens.
NoContextMenu.jpg
4) I have not tried 4.1 b2. I am not trying betas, just full release versions. My development team is currently developing a product and cannot rely on betas. Not that we don't trust your betas, but we're on a very tight schedule and cannot have the risk of something failing and then spending time checking if the problem is in the beta or not. Our project managers would have our heads on spikes, as I'm sure you understand.
If you want me to test it on 4.1 b2, send me a URL to one of your 4.1 b2 samples and I will point my browser at it and try.
Sorry...
Regards,
Joao Maia
-
6 Feb 2012 3:48 AM #8
Any feedback on this issue ?
Regards,
jm
-
6 Feb 2012 10:39 PM #9
I can confirm the issue on 4.0.7, however the issue doesn't present itself on 4.1B2, it appears as though it was resolved as part of the layout changes.
As such, marking this as closed.Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote
