3.2.0

How do I simulate clicking on a tree node?

This seems very basic, but I can't figure it out. How can I simulate (in javascript) clicking on a tree node (for a given index value) with the result that the tree expands with that node selected?

Thanks.
Donn
December 10,
http://www.activewidgets.com/javascript.forum.10102.9/tree-control-suggestion.html
<script>

    var tree = {
        0: [1, 2, 3, 4],
        1: [5, 6],
        2: [7],
        3: [8],
        4: [9]
    }

    var obj = new AW.UI.Tree;
    obj.setItemText(["", "Home", "Favorites", "Font size", "Search", "Child node 1", "Child node 2"]);
    obj.setItemImage(["", "home", "favorites", "fontsize", "search"]);
    obj.setViewCount(function(i){return tree[i] ? tree[i].length : 0});
    obj.setViewIndices(function(i){return tree[i]});
    document.write(obj);

obj.onItemClicked = function( event, row){ 
var state = obj.getViewExpanded(row);
if (state == true) {
obj.setViewExpanded(false, row); }
else {
obj.setViewExpanded(true, row); }
} 

var button = new AW.UI.Button;
button.onControlClicked = function(){obj.onItemClicked(null,3)}
document.write(button );

</script>
December 10,

This topic is archived.

See also:


Back to support forum