[英]Selecting specific cells in a grid - Ext JS
I have set up a controller here that listens for a click on a grid row: 我在这里设置了一个控制器,用于监听对网格行的单击:
init: function() {
this.control({
'mygrid': {
select: this.viewDesc //On click...
}
});
},
Right now this event fires no matter what cell is clicked on. 现在,无论单击哪个单元格,都会触发此事件。 However, I want to listen for the click of a specific column/cells.
但是,我想听特定列/单元格的单击。
How could this be achieved? 如何做到这一点?
You can use cellclick
event for grid, and identify on which cell user has clicked, it would be something like : 您可以将
cellclick
事件用于网格,并确定用户单击了哪个单元,这将类似于:
init: function() {
this.control({
'mygrid': {
cellclick: function(view, td, cellIndex, record, tr, rowIndex, e, eOpts) {
// if clicked on cell 4, show popup otherwise ignore
if(cellIndex == 3) { // cellIndex starts from 0
Ext.Msg.alert('Selected Record', 'Name : ' + record.get('firstname') + ' ' + record.get('lastname'));
}
}
}
});
},
Above code snippet is taken from my answer to your previous question 上面的代码段摘自我对上一个问题的回答
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.