我对extjs很新,我想为我的树有一个内联编辑器,我知道在extjs中有一个TreeEditor,我不太清楚如何使用它,有没有人有一个小例子让我从Ext.tree.TreeEditor开始?
由于
答案 0 :(得分:5)
是的,这个确实很糟糕,因为网上没有好的文档。这是一个简短的示例,来自文档和ExtJS in Action:
var tree = new Ext.tree.TreePanel({
root: this.getChildren(),
height: 300,
loader: new Ext.tree.TreeLoader(),
useArrows: true,
autoScroll: true,
listeners: {
dblclick: onTreeNodeDblClick
}
});
var treeEditor = new Ext.tree.TreeEditor(tree, {}, {
cancelOnEsc: true,
completeOnEnter: true,
selectOnFocus: true,
allowBlank: false,
listeners: {
complete: onTreeEditComplete
}
});
onTreeNodeDblClick: function(n) {
treeEditor.editNode = n;
treeEditor.startEdit(n.ui.textNode);
}
onTreeEditComplete: function(treeEditor, o, n) {
//o - oldValue
//n - newValue
}