1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    35
    Vote Rating
    1
    Oxii is on a distinguished road

      0  

    Default Check Change Listener

    Check Change Listener


    What is the right way to handle menu check items events ?
    I have this menu:
    Code:
     {      xtype: 'button',  
            id: 'types_btn',  
           autoWidth: true,   
           text: 'Types',  
           menu: {        
               xtype: 'menu',   
               frame: true,        
              id: 'types_menue',     
              items: [              
             {                    
                  xtype: 'menucheckitem',           
                  id: 'f_type',                 
                  text: 'first',                  
                  listeners: {                    
                     checkchange: {                 
                         fn: me.onFirstButtoncheckchange,           
                        scope: me           
                             }                          
                }                  
         },                      
     {                   
                     xtype: 'menucheckitem',     
                      id: 's_type',           
                     text: 'second',                  
                     listeners: {                        
                           checkchange: {                 
                                  fn: me.onSecondButtoncheckchange,         
                                 scope: me                              
          }                      
                    }             
              }


    Then the functions:

    Code:
    onFirstButtoncheckchange: function(menucheckitem, checked, options) {   
     var t = Ext.getCmp('f_type');        
           if (t.checked)              
         goToFunction(???);            
            .        
            .    
    }, 
    
    onSecondButtoncheckchange: function(menucheckitem, checked, options) {    
    var t = Ext.getCmp('s_type');       
            if (t.checked)             
          goToFunction(???);        
             .          
            .    },


    1- Is there anyway to use one listener and gather all different functions in it ?

    2- How can I send the current item to goToFunction() as you see in the code ?

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,589
    Vote Rating
    322
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      1  

    Default


    The first argument passed to the listener function is the CheckItem instance. You don't need to look it up using Ext.getCmp, you already have it.

    In general you should avoid using fixed ids and Ext.getCmp.

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    35
    Vote Rating
    1
    Oxii is on a distinguished road

      0  

    Default


    Thank you.

Thread Participants: 1

Tags for this Thread

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