:: Forum >> Version 2 >>

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 == 0 ? "red" "black";});
tree.getItemTemplate().setStyle("color", function(){
    return 
this.getItemProperty("mycolor");});
 
CK
Friday, October 14, 2011
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
Friday, October 14, 2011

Post a reply:

Text:
Name:

Back to support forum

Forum search