我是GXT 3的新手,对API感到困惑。也许你可以澄清一下。
在编辑器网格中,如何捕捉并检查在焦点内的单元格中按下的键盘键?
答案 0 :(得分:2)
创建网格并将其传递给GridEditing实例:
final GridEditing<MyType> ge = new GridInlineEditing<MyType>(grid);
// note:final Grid grid = new Grid(store,cm);
//注意:ColumnModel cm = new ColumnModel(configs);
// note:List&gt; configs = new ArrayList&gt;();
构建ColumnConfig
ColumnConfig<MyType, String> kanji = new ColumnConfig<MyType, String>(kfgProps.kanji());
//注意:kfgProps扩展了PropertyAccess
添加您的编辑器
ge.addEditor(kanji, text);
// note:text = new TextField();
添加您的DomHandler
text.addDomHandler(new KeyDownHandler() {
@Override public void onKeyDown(KeyDownEvent event) {
if (KeyCodes.KEY_ENTER == event.getNativeEvent().getKeyCode()) {
// do whatever
}
}
}, KeyDownEvent.getType());