2013-03-05 77 views
0

我在extjs4工作。我將卡在一個點,我必須處理複選框上的選中和未選中的事件。我沒有找到適合此選擇的事件。我只是想在複選框處理選中和未選中事件..如何處理在extjs4複選框上選中和未選中的事件?

這裏是我的一些代碼

1)視圖代碼:----

Ext.define('Am.user.Login', { 
    extend:'Ext.form.Panel', 
    id:'loginId', 
    alias:'widget.Login', 
    title:'Get your key to socialize yet earn and learn (always free)', 

    items:[ 
    { 
    ----  
    }, 
    { 
     xtype:'checkbox', 
     fieldLabel: 'Remember me', 
     name: 'remember', 
     //id:'checkbox1', 
     action:'check' 

    }, 
    ], 
}); 

2)控制器代碼: - -

Ext.define('Am.sn.UserController', 
     { 

      extend:'Ext.app.Controller', 
       ------------ 
        ----- 
      init:function() 
      { 
       console.log('Initialized Users! This happens before the Application launch function is called'); 
       this.control(
       { 
        'Login button[action=loginAction]': 
        { 
         click:this.authenticateUser 
        }, 
        'Login checkbox[action=check]': 
        { 
         change:this.checkedRemeberMe 
        }, 

       }); //end of control 
      },//end of init function 
      checkedRemeberMe:function() 
      { 
       console.log("check box selected"); 
      }, 
     }); 

在這裏,我要使用更改事件,但它調用時,它處於選中狀態,每次.. 哪個事件我這裏需要? 請給我一些建議...

回答

0

爲什麼你不使用複選框的處理程序配置?通過這樣做,每次選中或取消選中該框時都會觸發此操作。在那裏做你的工作。