2014-12-22 4 views
0

extjs에 체크 된 체크 상자 값을 얻기 위해 편집기 격자 패널에서 checkcolumn의 리스너를 선언하는 방법은 무엇입니까? 행의 체크 상태가체크 열 항목이 Extjs에서 작동하지 않습니다

{ 
     xtype: 'checkcolumn', 
     dataIndex: 'active', 
     listeners : { 
      'checkchange' : function(this,rowindex,isChecked){ 
       console.log(rowindex);//this return the index of the record check in gridusing this index you can get the record from the store that is used by the Grid panel. 
     } 
     } 

희망이 도움을 변경하면

답변

0

간단한 예 ..

var store = Ext.create('Ext.data.Store', { 
fields : ['name', 'email', 'phone', 'active'], 
data : { 
    items : [ 
     { name : 'Lisa', email : '[email protected]', phone : '555-111-1224', active : true }, 
     { name : 'Bart', email : '[email protected]', phone : '555-222-1234', active : true }, 
     { name : 'Homer', email : '[email protected]', phone : '555-222-1244', active : false }, 
     { name : 'Marge', email : '[email protected]', phone : '555-222-1254', active : true } 
    ] 
}, 
proxy : { 
    type : 'memory', 
    reader : { 
     type : 'json', 
     root : 'items' 
    } 
} 
    }); 

Ext.create('Ext.grid.Panel', { 
title : 'Simpsons', 
height : 200, 
width : 400, 
renderTo : Ext.getBody(), 
store : store, 
columns : [ 
    { xtype : 'checkcolumn', text : 'Active', dataIndex : 'active' }, 
    { text : 'Name', dataIndex : 'name' }, 
    { text : 'Email', dataIndex : 'email', flex : 1 }, 
    { text : 'Phone', dataIndex : 'phone' } 

] 
}); 
관련 문제