3.2.0

tree.setItemValue

For example, tree.setItemValue(true,4) doesn't work with event tree.onItemValueChanged:
var MyTreeCheckbox = AW.Tree.Item.subclass(); 
MyTreeCheckbox.create = function(){ 
    AW.Templates.Checkbox.create.call(this); 
} 

var treeValue = ["", true, false, "mixed", false, true, false]; 
var treeText = ["", "Home", "Favorites", "Font size", "Search", "Child1", "Child2"]; 
var treeImage = ["", "home", "favorites", "fontsize", "search"]; 
var treeView = {0:[1, 2, 3, 4], 1:[5, 6], 2:[7], 3:[8], 4:[9]}; 

var tree = new AW.UI.Tree; 
tree.setItemTemplate(new MyTreeCheckbox); 
tree.setItemValue(treeValue); 
tree.setItemText(treeText); 
tree.setItemImage(treeImage); 
tree.setViewCount(function(i){return treeView[i] ? treeView[i].length : 0}); 
tree.setViewIndices(function(i){return treeView[i]}); 

document.write(tree);

tree.onItemValueChanged= function(value, i) { 
tree.setItemValue(true,4);

}

//tree.setItemValue(true,4);


This code working correct:

...................
document.write(tree);
tree.setItemValue(true,4);


Help please.
Thanks.
Igor K.
September 5,
hi all,
I am new to ActiveWidgets,Is it possibe to create tree view with checkbox.
Any one give me a sample code
pradeep
September 6,
Igor,

this code creates a loop, setItemValue triggers onItemValueChanged event -

tree.onItemValueChanged = function(value, i) { 
    tree.setItemValue(true,4);
  }


Pradeep,

see the example here -

http://www.activewidgets.com/javascript.forum.17937.3/can-a-checkbox-be-included.html
Alex (ActiveWidgets)
September 6,
Hi Alex,
Thanks for your comments.
Also please.
Is it possibe to change property Value for tree child node checkbox in loop, if clicked parent node.
How can I call setItemValue with event onItemValueChanged , because following code creates a loop too:
tree.onItemValueChanged = function(value, i) {
updateChild();
}
...........................
function updateChild(){

tree.ItemValue(true,4);
}

Thanks very much and sorry for my English.
Igor K.
September 7,
Pradeep,
see also -

http://www.activewidgets.com/javascript.forum.17884.10/tree-changing-size-adding-and.html
Ankur Motreja
Friday, January 5, 2007
Igor K.
September 7,

This topic is archived.

See also:


Back to support forum