1

(15 replies, posted in Help)

ah yes !! Thanks all is ok now !

(The alert of new post on this forum by mail is now ok too ...)

One last question (for the moment !;) Where are you from ?! wink

Thanks for all

2

(15 replies, posted in Help)

That was post yesterday by mail. Have you received it ?

3

(15 replies, posted in Help)

I send your an accound by email form.

Have you received it ?

4

(15 replies, posted in Help)

YES ! That's work fine ! Thanks for your help !

I begin to anderstand better your work ...

But can I go too far with an other question ?? wink

I have make this plugin :

Mif.Tree.implement({
    getNodesOrder: function(){
        var node=this.forest ? this.root.getFirst() : this.root;
        var saveString = '';
        saveString += node.data.id + "-0,";
        node=node.getNextVisible();
        do{
            saveString += node.data.id + "-" + node.getParent().data.id + ",";
        }while(node=node.getNextVisible());
        return saveString;
    }
});

And I try to use it like this :

initialize: function(){
    new Mif.Tree.Drag(this, {
        onComplete: function(){
            alert(tree.getNodesOrder());
        }
    });
}

The plugin is well loaded but firebug say :
tree.getNodesOrder is not a function
[Break on this error] alert(this.getNodesOrder());

That work fine with the old version of MifTree but not with the SVN version.

5

(15 replies, posted in Help)

Thanks Moro ! You're right ! if(this.isLoaded()) seem to be good.

But I don't know how to find a node with his data. In my exemple, the nodes have data like : node.data.id

If I have the id that I want to select, how can I find the ref of the node to give in param at

yourTree.select(param)

?

6

(15 replies, posted in Help)

And an other question (thanks!), is it possible to force the selection of one element once the tree is reloaded ?

For exemple, after having toggled all the elements, I whant to place the selector on the element with node.data.id = 123

7

(15 replies, posted in Help)

ok, thanks for your answer !!

But I've got an other problem now ...

With your method, when tree is toggled, all subnodes are loaded with ajax. That I want is to toggle all the nodes already loaded ! Is it possible ?

8

(15 replies, posted in Help)

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();
    });
}