ExtJS 4を使用して、ユーザーが数字の長いリストを入力するグリッドを作成したいと思います。ユーザーが「Enter」を押して1つのセルの編集を終了し、自動的に下のセルに移動して編集を開始できるようにしたいと思います。
Ext.grid.plugin.CellEditingは編集の目的ではうまく機能しているようですが、keyUpイベントを検出して処理する方法が見つかりません。
このコードで「edit」イベントを使用して問題にアプローチしてみました。
selType: 'cellmodel',
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
listeners: {
edit: function (editor, e, eOpts) {
// If the event is fired by pressing "Enter", the column and row associated with event will
// be the same as the currently selected row and column
if (e.grid.selModel.position.column == e.colIdx && e.grid.selModel.position.row == e.rowIdx){
// Check if we are in the final row
if (e.rowIdx+1 == e.grid.getStore().getTotalCount()){
return true;
}
editor.startEditByPosition({row: e.rowIdx+1, column: e.colIdx});
return false;
}
}
}
})
],
このアプローチの問題は、ユーザーがセルの編集を開始し、グリッドの外側のGUI要素をクリックした場合、編集イベントがこれを「Enter」キーが押されていることと区別しないことです。これは修正できますか?
おそらく、代わりにカスタムのSelectionModelを実装しようとすべきでしょうか?そのアプローチからどのように始めますか?