wangsuya
unread,Dec 4, 2008, 10:44:34 PM12/4/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mootree
Hi everyone
When I make tree by loop and array, and select the node how can I
know the node name? In bellow program, how can I know the "?" ?
Thanks in advance.
window.onload = function() {
// --- ordinary MooTreeControl example:
tree = new MooTreeControl({
div: 'mytree',
mode: 'files',
grid: true
},{
text: 'Root Node',
open: true
});
tree.disable(); // this stops visual updates while we're
building the tree...
var node1 = tree.insert({text:'Subnode 1', id:'1',
});
var test = node1.insert({text:'test', id:'1.2',
});
var node2 = tree.insert({text:'Subnode 2', id:'2',
icon:'sample_icons.gif#1', open
icon:'sample_icons.gif#2'});
var node3 = tree.insert({text:'Subnode 3', id:'3'});
var node2_1 = node2.insert({text:'Subnode 2.1', id:'2.1'});
var node2_2 = node2.insert({text:'Subnode 2.2', id:'2.2',
color:'#ff0000'});
var node2_3 = node2.insert({text:'Subnode 2.3', id:'2.3'});
var index1 = [];
var index2 = new String;
// from here I want to ask
for(j = 1; j <=10; j++)}
index2 = '2.2.'+j
index1[j] = node2_2.insert({text:'Subnode 2.2.'+j,
id:index2, color:'#00a000',
onSelect: function(state) {
if(state){
alert(?.id);
}
}
});
var node2_2_1_1 = index1[j].insert({text:'Subnode
2.2.1.'+j, id:'2.2.1.'+j
, color:'#0000ff'});
}
var node4 = tree.insert({text:'Subnode 4', id:'4',
icon:'sample_icons.gif#3'});
//tree.expand();
tree.collapse();
tree.enable(); // this turns visual updates on again.
}