3.2.0

set tree item style from code

Does anyone know how to set the style of a tree item (node) from code, not css? The following example works OK for the first tree on a page, but if I add a second tree then I get the javascript error "this[getInt[p]] is not a function.

tree.defineItemProperty("mycolor", function(index){
    return index % 2 == 0 ? "red" : "black";});
tree.getItemTemplate().setStyle("color", function(){
    return this.getItemProperty("mycolor");});
CK
October 14,
Actually, the above code DOES work for multiple trees if I use document.write(tree) to create each tree in code. Previously I was creating the trees via placeholers in the html page like this:

<span id='tree1'></span>
<span id='tree2'></span>


... but that technique leads to the aforementioned js error. Odd.
CK
October 14,

This topic is archived.

See also:


Back to support forum