2013-03-11 98 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" 
      } 
     } 
    ] 
}