2013-03-11 55 views
1

嗨朋友,我是新来的extjs 4,how to rename of extjs 4 tree node请给我一个建议,并给我一个参考。
下面树面板的代码如何重命名节点在extjs 4树

var treePanel = Ext.create('Ext.tree.Panel', { 
    id: 'tree-panel', 
    title: 'Taxonomy', 
    region: 'west', 
    collapsible: true, 
    split: true, 
    //multiSelect: true,        
    height: '100%', 
    width: '20%', 
    minWidth: 100, 
    rootVisible: false, 
    autoScroll: true, 
    store: store, 
    viewConfig: { 
     allowCopy: true, 


     plugins: { 
      ptype: 'treeviewdragdrop', 
      appendOnly: true, 
      ddGroup: 'selDD' 
     }, 
+1

你的问题不是描述足够。您是否希望最终用户能够编辑节点名称?或者您是否需要以编程方式更改节点的名称? – Reimius 2013-03-11 15:59:53

+0

仅编辑节点文本 – ravi9999 2013-03-11 19:24:52

回答

0

只需添加一列配置和编辑为单个列,这里是如何,我认为它会在你的代码工作:

var treePanel = Ext.create('Ext.tree.Panel', { 
    id: 'tree-panel', 
    title: 'Taxonomy', 
    region:'west', 
    collapsible: true, 
    split: true, 
    //multiSelect: true,        
    height:'100%',  
    width: '20%', 
    minWidth: 100, 
    rootVisible: false, 
    autoScroll: true, 
    store: store, 
    viewConfig: { 
    allowCopy: true, 


    plugins: { 
     ptype: 'treeviewdragdrop', 
     appendOnly: true, 
     ddGroup: 'selDD' 
    }, 
    columns: [ 
     { 
      xtype:  "treecolumn", 
      dataIndex: "text", 
      flex:  1, 
      editor:{ 
       xtype:  "textfield" 
      } 
     } 
    ] 
}