PDA

View Full Version : How to show menu using showAt method?



saadkhan
30 Nov 2009, 9:13 PM
Hi,
I am in a situation where I have made a menu which I want to open on my div`s right click event. In that event, I have the x and y position as well to get open the menu at that particular position. But myMenu.showAt() methos isnt working.
I have tried to pass array of integers and as well as simple two x and y coordinates but nothign is working.....Please let me know how to do it
This is what I have tried to do:


var myMenu = Ext.get('MapContextMenu');
myMenu.showAt([coords[0], coords[1]]); // where coords is the array
myMenu.showAt(10, 10);

Nothing is working!!!

Animal
1 Dec 2009, 12:26 AM
What debugging have you done?

saadkhan
1 Dec 2009, 1:25 AM
I checked and got to a conclusion that myMenu.show(); is running fine and is not throwing exception (when in try catch) but doesnt show menu even then too.
And showAt method is throwing exception the every way I have tried....that can I do for it?

Animal
1 Dec 2009, 4:49 AM
Exceptions have meanings. It's trying to tell you something.

saadkhan
1 Dec 2009, 7:26 PM
It is saying object has not method showAt TypeError.....
Object is of my menu!

Animal
1 Dec 2009, 11:25 PM
Is it?

You have read the API entry for Ext.get?

You've debugged it and LOOKED at it?

rblon
2 Dec 2009, 6:21 AM
and while you're looking at the API (http://www.extjs.com/deploy/dev/docs/source/Element.html#method-Ext-get), make sure to also read about the method (http://www.extjs.com/deploy/dev/docs/source/Ext-more.html#method-Ext-getCmp) two lines below...

it is a common beginners mistake.

saadkhan
2 Dec 2009, 9:34 AM
Yeah, I have read it carefully....and I am not that beginner too :)
The problem was like, I was writing Ext.getCmp wrong.....now its fine
Thanks a lot