JavaScript
Run Code
Open in Fiddle
Ext.application({ name: 'Fiddle', launch: function () { var main = Ext.Viewport; var store = Ext.create('Ext.data.TreeStore', { clearOnLoad: true, clearRemovedOnLoad: true, root: { id: '$ROOT', expanded: true, children: [{ id: 'AAA', text: 'Main node', leaf: false, children: [{ id: 'BBB', text: 'Second node', leaf: true, }] }] } }); var tb = Ext.create('Ext.Toolbar', { docked: 'top' }); main.add(tb); var but1 = Ext.create('Ext.Button', { text: 'Expand node and then press me', handler: function () { var node = store.getNodeById('BBB'); if(node) { store.remove(node); try { node.parentNode.removeChild(node); } catch (ex) { alert(ex); } } } }); tb.add(but1); var myTree = Ext.create('Ext.grid.Tree', { store: store, rootVisible: false }); main.add(myTree); } })