Greetings,
how would I got about refreshing a node in a tree that is built using LoadOnDemand? (ExpandMode set to ServerSideCallback)
The idea is to have a Node labelled 'refresh' as the first childnode of the node that is supposed to be refreshed. Like so:
-NodeToBeRefreshed
---Refresh
---ChildNode1
---ChildNode2
---ChildNode3
Clicking the Refresh Node should depopulate the 'NoteToBeRefreshed' and repopulate it.
I tried doing it server side by hooking up the click event of the node, check if it is a refresh node (which is marked as such in its value property), clear all childnodes of the parent node and then populate the parent node again.
However, two issues arise:
a. the image of all nodes that have been populated on demand beforehand vanish
c. the page is postbacked (I could live with that) and the tree is scrolled back to its top
Of course, a client side solution would be just as welcome (if not even more so).
What I came up with so far is the following:
The missing part here, however, is how to mark the parent node as not yet expanded (so to trigger the ServerSideCallback OnExpand event), plus the client side expanding of the parent node to trigger that event.
Thanks in advance
how would I got about refreshing a node in a tree that is built using LoadOnDemand? (ExpandMode set to ServerSideCallback)
The idea is to have a Node labelled 'refresh' as the first childnode of the node that is supposed to be refreshed. Like so:
-NodeToBeRefreshed
---Refresh
---ChildNode1
---ChildNode2
---ChildNode3
Clicking the Refresh Node should depopulate the 'NoteToBeRefreshed' and repopulate it.
I tried doing it server side by hooking up the click event of the node, check if it is a refresh node (which is marked as such in its value property), clear all childnodes of the parent node and then populate the parent node again.
However, two issues arise:
a. the image of all nodes that have been populated on demand beforehand vanish
c. the page is postbacked (I could live with that) and the tree is scrolled back to its top
Of course, a client side solution would be just as welcome (if not even more so).
What I came up with so far is the following:
function OnClientNodeClicked(treeView, args) |
{ |
var node = args.get_node(); |
// we only refresh a node, if its value is 'refresh' |
if(node.get_value() == "refresh" ) |
{ |
RefreshNode(node); |
return; |
} |
} |
function RefreshNode(node) |
{ |
// get the parent node |
var parentNode = node.get_parent(); |
// clear the parent node of all its child nodes |
var tree = node.get_treeView(); |
tree.trackChanges(); |
parentNode.get_nodes().clear(); |
tree.commitChanges(); |
// collapse the parent node |
parentNode.collapse(); |
} |
The missing part here, however, is how to mark the parent node as not yet expanded (so to trigger the ServerSideCallback OnExpand event), plus the client side expanding of the parent node to trigger that event.
Thanks in advance