PDA

View Full Version : Reload (refresh) one node in TreePanel



adam99g
27 Sep 2009, 10:12 PM
How reload (refresh) one node in TreePanel?

tree.getLoader().dataUrl = url;
myNode().reload();

It doesn't work.

Condor
27 Sep 2009, 10:33 PM
node.reload() reloads the children of the node, not the node itself.

You should try:

node.parentNode.reload();

adam99g
27 Sep 2009, 11:50 PM
The 'node' it's my parent node:)
In my opinion, the note is reloading but tree store from url not....

Condor
27 Sep 2009, 11:51 PM
I don't understand what you mean... Can you try to explain the problem better?

adam99g
28 Sep 2009, 12:02 AM
ok, i will trying.
I think, the node is reloading, but the store in tree not...

Condor
28 Sep 2009, 12:08 AM
'store in tree'? Please explain...

adam99g
28 Sep 2009, 12:38 AM
My tree using store from url:
dataUrl: index.php...

I make some change on my node.

And refresh this url before reload node:
tree.getLoader().dataUrl = url;

And
node.reload();

The node is reloading, but with old data.

Condor
28 Sep 2009, 12:53 AM
It should work (unless you specified a different loader for this node).

To make sure you should change:

node.getLoader().dataUrl = url;
node.reload();

adam99g
28 Sep 2009, 3:12 AM
node.getLoader().dataUrl = url;

and "url" should be the same which in whole tree?

Condor
28 Sep 2009, 3:51 AM
TreePanel support a global treeloader and/or a separate loader for every node.

If a node doesn't have a specific loader the tree loader will be used.

I don't know if you are using node specific loaders, so I simply suggested using the node loader just in case.

ps. If you are not using node specific loaders then this won't fix anything.

adam99g
28 Sep 2009, 4:01 AM
Ok, but how using node specific loaders? I'm using TreeLoader like this:

loader : new Ext.tree.TreeLoader(
{
dataUrl : file.php
uiProviders :
{
'col' : Ext.tree.ColumnNodeUI
}
}
),
and in file.php return json array with data.

Condor
28 Sep 2009, 6:30 AM
You probably don't want to use node specific loaders - that is not the problem anyway.

There must be something else wrong (but I don't know what).

adam99g
28 Sep 2009, 10:36 AM
ok, so could you write me examples of code to refresh one node in treePanel?
I would be very grateful:)

adam99g
30 Sep 2009, 3:07 AM
I think, when I reload my node it is reloading but with old data store....
how can I refresh tree data store?

hazimdikenli
30 Sep 2009, 2:29 PM
Have you found any solution to this, I am trying to achieve the same thing, but no luck.

I load all of the sub nodes (recursive) when I load the tree, maybe that is the reason, are you doing something similar?

hazimdikenli
30 Sep 2009, 11:49 PM
I have changed the loading method, it now only loads the requested tree-nodes direct-children, and reloading a node seems to be working properly now, reload on leaf-nodes does not work (once a leaf, does not necesserily mean always a leaf).

Can anyone confirm if this are the expected behaviours or bugs?

ankuravlani
26 Oct 2009, 1:38 PM
Were you able to solve this?

I am also facing the same issue, my leaf node doesnt get reloaded, even after calling node.reload().


Ankur