1. #1
    Sencha User
    Join Date
    Feb 2008
    Posts
    13
    Vote Rating
    0
    dawnJ2SB is on a distinguished road

      0  

    Default Can't remove event from custom button

    Can't remove event from custom button


    Using Ext2.2

    I created custom buttons for adding/deleting people in a list. When the list is empty, the 'delete' button should turn gray and remove the 'delete' event. When I invoke the 'on' method to enable deleting, it works fine. But when I try to remove it, clicking the button still triggers the event. Is this a scope thing, or that the button is created with HTML, not ExtJs component. How do I make it work with current setup?

    This is how I create the button:

    Code:
    xtype:"container",
    autoEl:{
        tag:"div",
        id:"btn_recipients_delete_div",
        name:"btn_recipients_delete_div",
        style:"margin-left:40px; padding: 10px 0pt; float:left;",
        html:"<img id='btn_recipients_delete' alt='Delete Recipient' style='cursor:default;' src='//dms/myfax/resources/images/buttons/btn_recipients_delete_disable.jpg'>"
    },
    width:100,
    listeners:{
        render:{
            fn:function(){
                   //Ext.get("btn_recipients_delete").on("click", function(){return false;});
            }
            //,scope:this
        }
    }
    And when enable/disable toggling is triggered, this is how I code it. Enable works fine, disable does not remove event.

    Code:
    //disable button
    Ext.get('btn_recipients_delete').removeListener("click", function(){Websend_Global.deleteRecipientsBtn();});
    
    //enable button
    Ext.get('btn_recipients_delete').on("click", function(){Websend_Global.deleteRecipientsBtn();});
    I also tried this to remove event, which didn't work:
    Code:
    Ext.get('btn_recipients_delete').un("click", function(){Websend_Global.deleteRecipientsBtn();});
    Dawn
    OS: Windows XP sp3
    Server: Tomcat 6

  2. #2
    Sencha User
    Join Date
    Feb 2008
    Posts
    13
    Vote Rating
    0
    dawnJ2SB is on a distinguished road

      0  

    Default


    Figured it out. Since 'Websend_Global.deleteRecipientsBtn' was already defined as a function, adding the click using this must have added it twice or something:

    Code:
    deleteRecipientsBtn:function(){
            //delete people
    }
    
    obj.on("click", function(){Websend_Global.deleteRecipientsBtn()});
    So it should have been set as this and then obj.un('click',Websend_Global.deleteRecipientsBtn) works

    Code:
    obj.on("click", Websend_Global.deleteRecipientsBtn)
    Dawn
    OS: Windows XP sp3
    Server: Tomcat 6

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