PDA

View Full Version : [OPEN] Tree panel root node and expand collepse problem after setRootNode



spatel.engg
13 May 2014, 10:06 PM
Hello,

I am having problem when i refresh treepanel with setRootNode my rootNode disappears and also node expand and collapse is not working properly like animation is not working and once you expand node then it can't be collapsed and visa verse.

Please check :

5po

Thanks & Regards,
Sunil

mitchellsimoens
14 May 2014, 4:12 AM
This is a known issue. I've linked this thread to the issue.

documatrix
14 May 2014, 10:58 AM
Hi, I got exactly the same bug. Do you already know when this will be fixed? Thanks in advance! Kind regards, podsi

spatel.engg
24 Jun 2014, 12:05 AM
Any update on this? is there any workaround for this?

angelvan2013
28 Jul 2014, 6:00 AM
I also got this bug. I used a memory proxy and tried both tree.setRootNode(data) and tree.store.setRoot(data), then expanded node can be collapsed but after collapsed, it can not be expanded again.I dont know whether the ajax proxy is working or not.

ExtJsUser2255
4 Aug 2014, 3:50 AM
I am using a proxy of type "memory" defined on the model. After I update the tree with: treePanel.getStore().setRootNode(data) the nodes can be collapsed and then cannot be expanded.
Is anyone familiar with a workaround for this?

stan229
27 Aug 2014, 7:16 AM
I found a potential work around, it's a bit hacky.



Ext.override(Ext.tree.View, {
collapse : function (record, deep, callback, scope) {
this.callParent(arguments);
this.refresh();
},
expand : function (record, deep, callback, scope) {
this.callParent(arguments);
this.refresh();
}
});


This forces the view to refresh after the node operations occur. It doesn't look the view listens to changes on the Tree Store.

_ivan_
28 Aug 2014, 9:26 AM
Suggested workaround does not work for me.
However switching to ExtJs 5.0.1 seems to fix this issue

ypandey
10 Feb 2015, 2:41 AM
Hi,

I am facing same issue in my code. I just tried the fiddle with 5.0.7 and it works fine. But again in 5.1.1 the expand/collapse does not work. None of the workarounds solved the issue. Please let me know the what is the workaround or the build where this issue is fixed.

Thanks

khanh.tbh
2 Jun 2015, 7:37 PM
Hi!
In ExtJS 5.1.1 you guys can do this for set root node workaround

var treeStoreConfig = treepanel.getInitialConfig().store; // get the config of treepanel store
treeStoreConfig.root = { text: 'root', property: 'value'} //set root
var treeStore = Ext.create('Ext.data.TreeStore', treeStoreConfig); //create new store with current config and root
treepanel.setStore(treeStore); //set new store

Hope this help you all

sencha.dev
26 Jun 2015, 12:21 AM
Any update on this?

Nux
13 Jul 2016, 8:47 AM
Problem shown in the original Fiddle seem to be solved in new versions of ExtJS. But... There is another problem. Seems like ExtJS doesn't make a copy of the objects and adds some properties that when re-added make the list behave weird... Also you need to set the `expanded` for root (it used to be implied for root node in ExtJS 4).

Anyway. What used to be:

this.setRootNode({
children: this.someStaticConfig
});

Should now become:

this.setRootNode({
expanded: true,
children: Ext.clone(this.someStaticConfig)
});