************* Edited by moderator Adec ***************
Inserted missing < code></ code> tags. Always include such
tags when including code in your postings. Don't force the
moderators to do this for you. Many readers disregard
postings without the code tags.
**************************************************
Thanks for the above guys. I found, however, that when you collapse a node which is the parent of the currently selected node, then you need to perform the postback anyway. This is because the collapsed node becomes the new selected node.
Here is the revised function in treeview.htc for this enhanced functionality:
function nodePlusMinusClick()
{
if (g_bInteractive == false)
return;
var el = this.parentElement.treenode;
// 2 lines below commented out to disable postback on expand/collapse, extra lines added below for better functionality
// if (doNodePlusMinusClick(el) == true)
// fireQueuedEvents();
var index = getNodeIndex(el);
// if the selected or hovered node was one of the collapsed node's descendants then postback anyway
if (selectedNodeIndex.length > index.length && selectedNodeIndex.substr(0,index.length) == index)
{
if (doNodePlusMinusClick(el) == true)
fireQueuedEvents();
}
// otherwise just do the expand/collapse stuff
else
doNodePlusMinusClick(el);
}