PDA

View Full Version : Reload Tree Nodes on every Node Expand (or on demand)



jul1an
2 Jun 2011, 7:40 AM
How can I make so every tree node that is collapsed to forget it's data and to decide to reload on expand? Or to make a button that will cause a current selected node to refresh?

mitchellsimoens
2 Jun 2011, 4:12 PM
Listen to the itemcollapse event on the Ext.tree.Panel instance which passes the node. Then do your removal magic!

jul1an
2 Jun 2011, 11:04 PM
I tried to remove all children nodes on collapse, but this removes item expand icon [+], so this is what I made...


Ext.define('Place.view.place.Tree' , {

extend: 'Ext.tree.Panel',

listeners: {
'itemcollapse': function(node) {
node.data.loaded = false;
},
},
});

Is it OK? What about reload currently selected node?

stewardsencha
3 Nov 2013, 11:25 AM
Too bad you never got a response.

I take it from the "delete magic" hint (which is now old enough to be questionable) that nodes will be reloaded if they are missing, so you should remove a node from the store to force a reload.

But your solution got me going again, thanks. Seems to work fine in extjs 4.2.0.663