PDA

View Full Version : TreeStore : appendChild & id/internalId problems



n00b
23 Nov 2011, 10:24 AM
Hi,

Here is my problem :

When I use the ts.getRootNode().appendChild({id:123,text:'haha'});

My data in inserted into the store, I see the node 'haha' in the tree under the root... but its id and internalId are wrong. I've something like this for the id : [Name of my model]-ext-record-[integer] and internalId is like : ext-record-[integer].

- Note that the node.data.id gives me my correct id (ie. 123) so the data associated with the node is OK.

- Note also that my TreeStore is bound to a Model (MyModel) which has the idProperty set to 'id' (which is the default anyway...).

- Note agaaiiiiin that I tried appendChild with both a "regular" object : ie. appendChild({id:123,text:'haha'}); and also by creating a new instance of my model : ie. appendChild(Ext.create('MyModel',{id:123,text:'haha'}));

So the question is : how to programmatically add a child node and correctly supply its id/internalId so we are able to reach that node later (by using ts.getNodeById(123)).

Another issue (not really a serious problem) :

If the height of the treePanel isn't high enough to display all the items added by appendChild, I don't get any scrollbar, I have to issue a tree.doComponentLayout() or tree.getView().refresh() so the component is correctly displayed.

Imo, appendChild should do this on its own... even without sync()

Thank you guys :)

Jan (HL)
23 Nov 2011, 11:16 AM
If the height of the treePanel isn't high enough to display all the items added by appendChild, I don't get any scrollbar, I have to issue a tree.doComponentLayout() or tree.getView().refresh() so the component is correctly displayed.

In what context? I'd several problems with trees, but scrolling works perfectly and w/o these set of props of ExtJS 3. But I'm using a border layout because it is very reliable (west: tree, center: content).

radtad
11 Jan 2012, 5:50 PM
+1 on this. After I appendChild, getNodeById does not work either. I've tried



node.setId(<id>);
node.set('id',<id>);

with the field 'id' being the idProperty

jaimearmero
26 Mar 2012, 6:23 AM
Same problem with id/internalId inserting nodes dynamically. Using 4.1RC1. Any hints on this?
Thank you,