如何在ExtJS3网格中捕获Tab按键事件
我试图捕捉Tab键按下事件。这就是我所尝试的:如何在ExtJS3网格中捕获Tab按键事件,extjs,extjs3,Extjs,Extjs3,我试图捕捉Tab键按下事件。这就是我所尝试的: this.test.on('keypress', function(t,e) { if (e.getKey() == Ext.EventObject.ENTER) { alet('kk'); } }, this); 请帮助捕获网格单元格中的Tab键按下事件 This my EditorGridPanel override function Ext.override(Ext.grid.Editor
this.test.on('keypress', function(t,e) {
if (e.getKey() == Ext.EventObject.ENTER) {
alet('kk');
}
}, this);
请帮助捕获网格单元格中的Tab键按下事件
This my EditorGridPanel override function
Ext.override(Ext.grid.EditorGridPanel, {
initEvents : function(){
Ext.grid.EditorGridPanel.superclass.initEvents.call(this);
this.on("bodyscroll", this.stopEditing, this, [true]);
this.on("columnresize", this.stopEditing, this, [true]);
this.view.scroller.on("mousedown", this.onMouseDownEditClick, this);
this.on('keypress', function(t,e) {
// if (e.getKey() == Ext.EventObject.TAB) {
alert('kk');
// }
}, this);
//Reload datastore without redrawing grid
this.getView().on('beforerefresh', function(view) {
view.scrollTop = view.scroller.dom.scrollTop;
view.scrollHeight = view.scroller.dom.scrollHeight;
});
this.getView().on('refresh', function(view) {
setTimeout(function () {
view.scroller.dom.scrollTop = view.scrollTop + (view.scrollTop == 0 ? 0 : view.scroller.dom.scrollHeight - view.scrollHeight);
}, 100);
});
if(this.clicksToEdit == 'mousedown'){
this.view.scroller.on("mousedown", this.onMouseDownEditClick, this);
}else if(this.clicksToEdit == 1){
this.on("cellclick", this.onCellDblClick, this);
}else {
if(this.clicksToEdit == 'auto' && this.view.mainBody){
this.view.mainBody.on("mousedown", this.onAutoEditClick, this);
}
this.on("celldblclick", this.onCellDblClick, this);
}
},
onMouseDownEditClick : function(e, t){
if(e.button !== 0){
return;
}
var row = this.view.findRowIndex(t);
var col = this.view.findCellIndex(t);
edit_row = row;
edit_col = col;
if(row !== false && col !== false){
this.startEditing(row, col);
}
}
});
我看到你的代码有错。反而
alet('kk');
使用
但不管怎样,你有没有试着用这样的东西
this.test.on('keypress', function(t,e) {
if (e.getKey() == Ext.EventObject.TAB) {
alert('kk');
}
}, this);
我对此也有类似的问题,因为只有当事件发生在EditorGridPanel(而不是单个单元格)上时,“keypress”事件才会触发
我将事件侦听器放在EditorGridPanel的GridView上,特别是出于我的目的,侦听“rowupdated”事件()-我希望这对其他人有所帮助。感谢您的反馈实际上我正在尝试使用alert,但这不会给我任何提示。但是我在我的网格中覆盖了EditerGridPanel,以便单击编辑启用。现在我用这个代码编辑我的问题
this.test.on('keypress', function(t,e) {
if (e.getKey() == Ext.EventObject.TAB) {
alert('kk');
}
}, this);