我有带有checkcolumn的ExtJS GRID,它以这种方式声明:
// the check column is created using a custom plugin
sel_column = new Ext.grid.CheckColumn({
sortable: false,
header: 'STE<br />SEL',
dataIndex: 'sel',
width: field_w,
listeners:
{
"mousedown":
{
fn : function(e)
{
$.log( "Sel cellclick" , e );
}
}
}
});
我想在它的changfe上添加一些监听器,或者点击鼠标。 最终 - 想要行的id,我点击此列 - 存储在文本字段
现在我可以理解如何捕捉点击事件,我使用onMouseDown,这样:
// the check column is created using a custom plugin
sel_column = new Ext.grid.CheckColumn({
sortable: false,
header: 'STE<br />SEL',
dataIndex: 'sel',
width: field_w,
onMouseDown: function( e )
{
$.log( e,"MouseDown" );
}
});
但是当我点击任何一个单元格时,它会触发,而不仅仅是复选...
请帮助我
答案 0 :(得分:0)
复选框插件需要修改,之后它可以触发点击事件。
答案 1 :(得分:0)
/*
**************************************************************
Sample to add event 'checkchange' in checkbox on checkcolumn,
works with ExtJS 4 or above
*/
//Add you checkcolumn id:'op_check'. No need separate plugin.
//Put this code in You Grid
listeners:{
afterrender:function(){
g = this; //This grid
Ext.getCmp('op_check').on('checkchange', function(c, i){
//Get id from row/record (if in store exist field 'id')
//"i" - in this function is index row, where clicked checkbox
rec = g.store.getAt(i);
id = rec.get('id');
console.log(id); //:)
});
}
}