Topic: toggle Nodes
Hello,
I don't know why when I use this function :
.addEvent('onLoad', function(){
this.root.recursive(function(){
this.toggle(null, false);
});
})I've got this return by firebug :
node is null -> Mif.Tree.Node.js (ligne 36)
[Break on this error] var wrapper=node.getFirst();
An idea ?
----------------------
My entire function :
function makeTree(_id){
id = _id ? "&id=" + _id : "";
tree = new Mif.Tree({
container: $('tree_container'),
forest: true,
initialize: function(){
new Mif.Tree.Drag(this, {
onDrag: function(){
//
},
onStart: function(){
//
},
onComplete: function(){
alert(tree.getNodeOrders());
}
});
},
types: {
folder:{
openIcon: 'mif-tree-open-icon',
closeIcon: 'mif-tree-close-icon',
loadable: true
},
folderFinal:{
openIcon: 'mif-tree-open-icon',
closeIcon: 'mif-tree-close-icon',
loadable: false
},
file:{
openIcon: 'mif-tree-file-open-icon',
closeIcon: 'mif-tree-file-close-icon'
},
loader:{
openIcon: 'mif-tree-loader-open-icon',
closeIcon: 'mif-tree-loader-close-icon',
DDnotAllowed: ['inside','after']
}
},
dfltType:'folder'
})
.load({
url: 'modules/geographie3/lieux.ajax.php?ajax=treeRoot' + id
})
.addEvent('onLoad', function(){
this.root.recursive(function(){
this.toggle(null, false);
});
})
.addEvent('select',function(node){
lienAjax('modules/geographie3/lieux.ajax.php?categorie=' + node.data.id);
})
.loadOptions=function(node){
if(node.data != undefined){
return {
url : 'modules/geographie3/lieux.ajax.php?ajax=treeChild',
method : 'post',
data : {'id': node.data.id}
};
}
};
$('tree_btn_rename').addEvent('click', function(){
var node=tree.selected;
if(!node) return;
node.rename();
});
}Last edited by alphanono (2008-08-14 17:19:49)