编辑元素后在ExtJs4中丢失键导航

编辑元素后在ExtJs4中丢失键导航,extjs4,treepanel,Extjs4,Treepanel,我想实现带有键盘箭头导航的交互式TreePanel。第一次单击任何项目后,它都能正常工作。 我添加了keybinding-add、-edit、-deleting。显示添加对话框后,用户输入新项目的名称,然后按Ctrl-S或按保存按钮。以下是保存代码: saveItem: function(wnd) { rec = wnd.getRecord(); var store = this.getProductCategoryStore(); if (wnd.parent) {

我想实现带有键盘箭头导航的交互式TreePanel。第一次单击任何项目后,它都能正常工作。 我添加了keybinding-add、-edit、-deleting。显示添加对话框后,用户输入新项目的名称,然后按Ctrl-S或按保存按钮。以下是保存代码:

saveItem: function(wnd) {
    rec = wnd.getRecord();
    var store = this.getProductCategoryStore();

    if (wnd.parent) {
        parent = wnd.parent
        parent.data.leaf = false;
        parent.set('loaded', false);
    } else
        parent = this.getCategoryTree().getRootNode();

    if (rec.phantom)
        parent.appendChild( rec );
    store.sync();
    wnd.close();

    if (wnd.parent)
        parent.expand();

    this.getCategoryTree().focus();
    this.getCategoryTree().selectPath( rec.getPath() );
},

所以,最后两行是我试图关注的树,但它不起作用A>,-工作,但箭头不工作。如果我手动单击树,它会再次工作。

已解决。使用Ext.FocusManager了解focus在应用程序中的工作原理很酷。要在树中正确聚焦:

tree.getView().focus()