View Full Version : Simple context menu

23 May 2014, 11:13 AM
<!-- Begin ExtJS--> <script type="text/javascript" charset="utf-8" async defer> Ext.BLANK_IMAGE_URL = 'extjs/resources/images/default/s.gif'; Ext.onReady(function(){ console.log("Congratulations! You have Ext configured correctly!"); contextMenu = new Ext.menu.Menu({ items: [{ text: 'Edit', iconCls: 'edit', handler: callbackFunc }]});function callbackFunc () { console.log('Context menu callback function invoked')}Ext.getCmp('exampleButton').getEl().on('contextmenu', function(e) { e.preventDefault(); contextMenu.show(Ext.getCmp('exampleButton').getEl());});contextMenu.show(Ext.getCmp('exampleButton').getEl()); }); //end onReady </script><input name="exampleButton" id="exampleButton" type="button" value=" Go " />

But it displays the error message Ext.getCmp("exampleButton") is undefined

Please help??

23 May 2014, 12:34 PM
Can somebody at Sencha please investigate why posts keep having their newlines stripped like this?

@youds. Your exampleButton isn't a component, it's just an element. So instead of:


you'd use:


Gary Schlosberg
23 May 2014, 3:30 PM
I'll continue looking into the newline issue. Another thread had me thinking the issue had been resolved.