Y
ylarom
Pro bono publico...
After rendering the treeview.net tree, the code doesn't offer a means
to adding folders dynamically.
I've put in a little time investigating this, and here is the result:
function dynInsFolder(parent, folder)
{
// add to parent
insFld(parent, folder);
// build leftside indicator
var leftSide = parent.leftSideCoded;
if (parent.level > 0)
leftSide += (parent.isLastNode ? "0" : "1");
if (typeof leftSide == 'undefined')
leftSide = '';
// initialize
folder.initialize(parent.level + 1, true, leftSide)
// if parent has other siblings, rememer the last one
var lastSibling = (parent.nChildren == 1 ? null :
parent.children[parent.nChildren - 2]);
if (lastSibling != null)
lastSibling.isLastNode = 0;
// render the new folder if supposed to be visible
if (parent.isRendered && parent.isOpen)
{
// if no siblings, render after the parent, otherwise render after
the last sibling
var parentNavObj = (lastSibling == null ? parent.navObj :
lastSibling.navObj);
folder.renderOb(parentNavObj)
}
// if no siblings, need to update parent's node image and tree lines
if (parent.isRendered && parent.level > 0 && lastSibling == null)
refreshNodeImage(parent);
// if there is a sibling, need to update node image - change tree
lines to connect down as well
if (lastSibling != null && lastSibling.isRendered)
refreshNodeImage(lastSibling);
}
After rendering the treeview.net tree, the code doesn't offer a means
to adding folders dynamically.
I've put in a little time investigating this, and here is the result:
function dynInsFolder(parent, folder)
{
// add to parent
insFld(parent, folder);
// build leftside indicator
var leftSide = parent.leftSideCoded;
if (parent.level > 0)
leftSide += (parent.isLastNode ? "0" : "1");
if (typeof leftSide == 'undefined')
leftSide = '';
// initialize
folder.initialize(parent.level + 1, true, leftSide)
// if parent has other siblings, rememer the last one
var lastSibling = (parent.nChildren == 1 ? null :
parent.children[parent.nChildren - 2]);
if (lastSibling != null)
lastSibling.isLastNode = 0;
// render the new folder if supposed to be visible
if (parent.isRendered && parent.isOpen)
{
// if no siblings, render after the parent, otherwise render after
the last sibling
var parentNavObj = (lastSibling == null ? parent.navObj :
lastSibling.navObj);
folder.renderOb(parentNavObj)
}
// if no siblings, need to update parent's node image and tree lines
if (parent.isRendered && parent.level > 0 && lastSibling == null)
refreshNodeImage(parent);
// if there is a sibling, need to update node image - change tree
lines to connect down as well
if (lastSibling != null && lastSibling.isRendered)
refreshNodeImage(lastSibling);
}