A
Alex D.
Hi. I am trying to dynamically change the nodes pictures in javascript in my
treeview and with patience I visited all the urls in my ImageArray to see
what picture was. Then I used the same url to get to that picture but it was
a different picture!! I know those pictures are created dynamically by
asp.net but I thought the positions in the array were always the same
because the TreeView_ToggleNode(...) function uses fixed positions in its
code (see below). Am I doing something wrong?? Thanks. alex.
function TreeView_ToggleNode(data, index, node, lineType, children) {
var img = node.childNodes[0];
var newExpandState = "e";
if (children.style.display == "none") {
children.style.display = "block";
if (img != null) {
if (lineType == "l") {
img.src = data.images[15];
}
else if (lineType == "t") {
img.src = data.images[12];
}
else if (lineType == "-") {
img.src = data.images[18];
}
else {
img.src = data.images[5];
}
img.alt = data.collapseToolTip.replace(/\{0\}/,
TreeView_GetNodeText(node));
}
}
else {
newExpandState = "c";
children.style.display = "none";
if (img != null) {
if (lineType == "l") {
img.src = data.images[14];
}
else if (lineType == "t") {
img.src = data.images[11];
}
else if (lineType == "-") {
img.src = data.images[17];
}
else {
img.src = data.images[4];
}
img.alt = data.expandToolTip.replace(/\{0\}/,
TreeView_GetNodeText(node));
}
}
data.expandState.value = data.expandState.value.substring(0, index) +
newExpandState + data.expandState.value.slice(index + 1);
}
treeview and with patience I visited all the urls in my ImageArray to see
what picture was. Then I used the same url to get to that picture but it was
a different picture!! I know those pictures are created dynamically by
asp.net but I thought the positions in the array were always the same
because the TreeView_ToggleNode(...) function uses fixed positions in its
code (see below). Am I doing something wrong?? Thanks. alex.
function TreeView_ToggleNode(data, index, node, lineType, children) {
var img = node.childNodes[0];
var newExpandState = "e";
if (children.style.display == "none") {
children.style.display = "block";
if (img != null) {
if (lineType == "l") {
img.src = data.images[15];
}
else if (lineType == "t") {
img.src = data.images[12];
}
else if (lineType == "-") {
img.src = data.images[18];
}
else {
img.src = data.images[5];
}
img.alt = data.collapseToolTip.replace(/\{0\}/,
TreeView_GetNodeText(node));
}
}
else {
newExpandState = "c";
children.style.display = "none";
if (img != null) {
if (lineType == "l") {
img.src = data.images[14];
}
else if (lineType == "t") {
img.src = data.images[11];
}
else if (lineType == "-") {
img.src = data.images[17];
}
else {
img.src = data.images[4];
}
img.alt = data.expandToolTip.replace(/\{0\}/,
TreeView_GetNodeText(node));
}
}
data.expandState.value = data.expandState.value.substring(0, index) +
newExpandState + data.expandState.value.slice(index + 1);
}