1. #1
    Ext JS Premium Member
    Join Date
    Sep 2010
    Location
    Jyderup, Denmark
    Posts
    51
    Vote Rating
    0
    lasseok is on a distinguished road

      0  

    Default Can't get contextmenu/click event working

    Can't get contextmenu/click event working


    Hi guys

    I'm having trouble getting the contextmenu event working in the beta...

    Basically I want to make my own right click menu. But I couldn't get the contextmenu event to fire. So I tried a simple click event instead and that won't fire either:

    Code:
    Ext.onReady(function(){
        var panel = new Ext.panel.Panel({
            title: 'Editor',
            renderTo: 'editor',
            width: 600,
            height: 300,
            layout: 'fit',
            listeners: {
                    click: function(e){
                            console.log("Click");
                    }
                }
        });
    });
    I can, however, add a listener for the render event that'll actually fire. In the API docs events such as "click" and "contextmenu" aren't even listed anymore.

    What am I missing?

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Click is a DOM event.

    Do you want to add a listener to the Panel's header? It's toolbar?

    Or, do you really mean that you want to add a listener to the Panel's body element?

  3. #3
    Ext JS Premium Member
    Join Date
    Sep 2010
    Location
    Jyderup, Denmark
    Posts
    51
    Vote Rating
    0
    lasseok is on a distinguished road

      0  

    Default


    Yes, what I really mean is that I want to add the event listener to the panl's body element.

  4. #4
    Ext JS Premium Member
    Join Date
    Sep 2010
    Location
    Jyderup, Denmark
    Posts
    51
    Vote Rating
    0
    lasseok is on a distinguished road

      0  

    Default


    I would really appreciate an example, if you would be so kind.

  5. #5
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    Here is an example:

    Code:
    var panel = Ext.createWidget('panel', {
      bodyPadding: 7,
      width: 300,
      height: 300,
      border: true,
      title: 'Panelwith custom Cls',
      html: 'Some content',
      bodyCls: 'customCls',
      bodyStyle: 'color:red',
      renderTo: Ext.getBody()
    });
    
    panel.body.on('click', function() {
      console.log('click');
    });
    panel.body.on('contextmenu', function() {
      console.log('contextmenu');
    });
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  6. #6
    Ext JS Premium Member
    Join Date
    Sep 2010
    Location
    Jyderup, Denmark
    Posts
    51
    Vote Rating
    0
    lasseok is on a distinguished road

      0  

    Default


    Thank you, Steffen!

    But, suppose I wanted to listen for the contextmenu event on the body of an Ext.form.HtmlEditor? It doesn't have a body property, and bodyEl doesn't seem to work.

  7. #7
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    this won't work as the htmlEditor is an iframe, you can explore yourself:
    Code:
    Ext.fly(ed.getEditorBody())
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

Similar Threads

  1. handler/click event not working when clicked in IE7
    By amodg in forum Ext 3.x: Help & Discussion
    Replies: 10
    Last Post: 4 Aug 2011, 4:20 AM
  2. ContextMenu: right click on grid
    By hallikpapa in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 8 Sep 2009, 10:57 AM
  3. Now "right-click" or "contextmenu" event on Button?
    By dbassett74 in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 11 Jul 2009, 10:19 AM
  4. Replies: 0
    Last Post: 3 Mar 2008, 1:46 PM

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi