View Full Version : Can't get the TreeStore and TreePanel working - can't append child from form

10 Feb 2012, 6:03 AM
I use ext-4.0.7-gpl (in 4.1 beta 2 the tree doesn't load at all)

As we don't have RowEditing, I added an action column with the add button, to append child, see below.

The TreeStore is made with Designer, it seems okay and standard, I'll provide the code if it is needed. The only thing I did was changing the api,

Ext.apply(proxy.actionMethods, {
update: 'PUT',
create: 'POST',
destroy: 'DELETE'

I noticed that the store doesn't sync without explicit syncing; that the proxy uses 'update' operation when I was appending a new child; that the TreeStore cannon handle the server side id generation (in the method onUpdateRecords of Ext.data.TreeStore, in the line "original = me.tree.getNodeById(record.getId());").

What did I do wrong, or could it be a bug?

It also seemed to me that the code in appendChild method of NodeInterface ignores that the node was not expanded and loaded and pushes my new node into an empty childNodes array, so that on the screen I don't see siblings of my new node.

Is there any working example of how the tree editing process can be coded?


The code below has some commented attempts to try different ways, just for your fun.

icon: 'lib/ext4/resources/themes/images/default/dd/drop-add.gif',
tooltip: 'Add',
handler: function(grid, rowIndex, colIndex) {
var domainForm = Ext.create('PetroRes.view.DomainForm');
var wnd = Ext.create('Ext.Window', {
closable: true,
title: 'Edit Domain',
maximizable: false,
maximized: false,
layout: 'fit',
items: [
fbar: [
xtype: 'button',
itemId: 'selectButton',
text: 'Save',
listeners: {
click: function(){


var node = grid.store.getAt(rowIndex);
var newDomain = domainForm.getValues();
newDomain.parent = {id: node.raw.id};
var newNode = node.appendChild(newDomain);
console.log([node, newNode]);
xtype: 'button',
itemId: 'cancelButton',
text: 'Cancel',
listeners: {
click: function(){

12 Feb 2012, 11:35 PM
I can't get 4.1 beta 2 working too.

When loading a treepanel, the Loading grayout sticks over the panel, until I click somewhere; then expanding any of the nodes breaks on method onUpdate of Ext.view.Table, showing in debugger changedFieldNames = ['loading'], as if I updated the 'loading' field of a node...

16 Feb 2012, 3:53 AM
for those interested, i made a hacking workaround, see here: http://stackoverflow.com/questions/8653445/extjs-treestore-update-event-fire-instead-of-create/9228517#9228517

27 Feb 2012, 5:09 AM
i have the same problem

node = {
text: values.name,
parent_id: values.parent_id,
parentId: values.parent_id
//parent.data.leaf = false;

generate 4me on REST tree Store PUT megod for appendChild ! Sencha sholud show good exaple to work witrch tree+rest and explain why appendChild generate PUT methods..