Results 1 to 4 of 4

Thread: Another simple contextmenu

  1. #1
    Sencha User youds's Avatar
    Join Date
    Jun 2008
    Posts
    8

    Default Another simple contextmenu

    Hi

    I previously posted a thread asking about a contextmenu, however, here's another for you.
    Code:
            <!-- Begin ExtJS-->
            <script type="text/javascript" charset="utf-8" async defer>
            Ext.BLANK_IMAGE_URL = 'ext-4.2.1.883/resources/images/default/s.gif';
            Ext.onReady(function(){
                console.log("Congratulations!  You have Ext configured correctly!");
                var removeAction = Ext.create('Ext.Action', {
        icon:'img/star_red.png',
        text: 'Remove this element, because I don\'t like it',
        handler: function(widget, event) {
            if(confirm("This element will be removed from DOM. You will need to refresh your browser to make it reappear. Continue?")) {
                Ext.get("elementContextMenu").remove();    
            }
            return false;
        }
    });
    
    var contextMenu = Ext.create('Ext.menu.Menu', {
        items: [
            removeAction
        ]
    });
    Ext.get("elementContextMenu").on("contextmenu", function(event,element){
        event.stopEvent();
        console.log(contextMenu.showAt(event.getXY()));
        return false;
    })
            }); //end onReady
            </script><div style="padding:15px;background:#EEE;border:3px solid #AAA;border-radius:10px;color:#000;width:500px;margin:50px" id="elementContextMenu">Right click here</div>
    When I right click the div, nothing happens??

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

    Default

    Literally nothing? Not even the default browser menu? No error messages?

    Try using a simpler event (e.g. click) and a simpler acceptance test (just do some console logging, don't try to show a menu). Add some breakpoints to confirm exactly which lines get hit.

  3. #3
    Sencha User youds's Avatar
    Join Date
    Jun 2008
    Posts
    8

    Default

    Literally, nothing. Not even the default browser menu, or error messages.

  4. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •