2011-12-16 18 views
2

チェックボックス(またはすべてのチェックボックスを選択)をクリックすると、CheckboxSelectionModelにリスナーを追加したいと考えています。ExtJS CheckboxSelectionModel Listener

var smSensors = new xg.CheckboxSelectionModel(); 

このリスナーはどのように追加しますか?

ありがとうございます!

答えて

3

リスナーを次のようにチェックボックス選択モデルに追加し、行が選択されているときに必要な処理を行います。

var checkBoxSelMod = new Ext.grid.CheckboxSelectionModel({ 
    listeners:{ 
     rowselect : function(selectionModel, rowIndex, record){ 
      var selectedRows = selectionModel.getSelections(); 
      if(selectedRows.length > 0){ 
       for(var i = 0; i 0){ 
        for(var i = 0; i < selectedRows.length; i++) { 
         ; // Do whatever you want to do 
        } 
       } 
       // More code related to deselection of a chekbox 
      } 
     } 
    } 
});