3.0 beta 2

Repopulating a Tree

I am trying to dynamically rebuild a Tree based upon a user selecting a new target as the data source for the tree (code creates new data and calls methods to bind the data, etc). When I apply the changes, the tree is blank. Note that I want to avoid completely rebuilding the tree.

Little background:

A) A Combo above the list contains N names of XML files that can be used to populate the tree. On the server, I have a generic routine that binds XML to your tree control. First load, everything is fine.
B) User selects a new data source. Ajax is used for communication (have used this for many things and it works fine).
C) I reconstruct the data and call the following with the new values:

tree.clear(); // added as experiment
tree.setItemText(treeText);
tree.setItemImage(treeImage);
tree.setViewCount(function(i){return treeIdx[i] ? treeIdx[i].length : 0
});
tree.setViewIndices(function(i){return treeIdx[i]});
tree.refresh();

D) Since your image handling is very CSS centric, I use the following technique to dynamically change images.

LOADED FIRST TIME:

<link id='image_css_0' rel="stylesheet" type="text/css">

and

LOADED EVERY TIME:

document.getElementById('image_css_0').href='image_css_0.css';

This works fine on the initial load.

I doubt that the image handling would cause a completely blank tree. It appears to be much more fundamental than that.

Pls Help - Thx



Brian Boyd
April 12,
Sorry,

Disregard the bug, I did not reset the indexes properly.

But if you have alternative suggestions for changing image sets, I'm all ears. I don't think this is a clean solution. Note that including all images on the first load is not an option.
Brian Boyd
April 12,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.