0
У меня есть панель дерева, и я пытаюсь добавить ниже выбранный элемент.Дерево extjs wont appendChold для выбранного узла в панели дерева
Если нажать на "Добавить в корень", она работает.
Но. если вы нажмете на «Избранное», он не работает:
Ext.application({
name: 'Fiddle',
launch: function() {
var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [{
text: "detention",
leaf: true
}, {
text: "homework",
expanded: true,
children: [{
text: "book report",
leaf: true
}, {
text: "algebra",
leaf: true
}]
}, {
text: "buy lottery tickets",
leaf: true
}]
}
});
Ext.create('Ext.tree.Panel', {
//title: 'Simple Tree',
itemId: 'projectTree',
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop'
}
},
id: 'projectTree',
width: 200,
height: 500,
store: store,
renderTo: Ext.getBody(),
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items: [{
text: 'Add To Selected',
handler: function() {
var treeNode = Ext.getCmp('projectTree').getSelectionModel().getSelection()
treeNode.appendChild({
text: 'Child 4',
leaf: false
});
}
}, {
text: 'Add to root',
handler: function() {
var treeNode = Ext.getCmp('projectTree').getRootNode();
treeNode.appendChild({
text: 'Child 4',
leaf: false
});
}
}]
}],
});
}
});
Что делать вы подразумеваете под «не работает»? Вы пытались добавить трассировку? – Thevs
@Thevs, он не добавляет к ребенку, посмотрите на ссылку, которую я положил – SexyMF