Skip to forum content

Mif

— mystic javascript interface

You are not logged in. Please login or register.


Post new reply

Post new reply

Compose and post your new reply

You may use: BBCode Images Smilies

All fields labelled (Required) must be completed before the form is submitted.

Required information for guests



Captcha image. Turn pictures on to see it.
Required information
Optional post settings

Topic review (newest first)

1

alphanono wrote:

Where are you from ?! wink

Russia

2

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

3

yes, i'm received.

problem is varible tree not a Mif.Tree instance, but function.

replace

tree = new Mif.Tree({
        ...
    })
    
    .load({

     ...

    })

    .loadOptions=function(node){
        if(node.data != undefined){
            return {
                url        : 'modules/geographie3/lieux.ajax.php?ajax=treeChild',
                method    : 'post',
                data    : {'id': node.data.id}
            };
        }
    };//<---- function

with

tree = new Mif.Tree({
        ...
    })
    
    .load({

     ...

    });

    tree.loadOptions=function(node){
        if(node.data != undefined){
            return {
                url        : 'modules/geographie3/lieux.ajax.php?ajax=treeChild',
                method    : 'post',
                data    : {'id': node.data.id}
            };
        }
    };

4

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

5

alphanono wrote:

Have you received it ?

no, send to magmoro@mail.ru or creavenmoro@gmail.com

P.S. i'm fix e-mail form. It should send mail now.

6

I send your an accound by email form.

Have you received it ?

7

don't know where problem, mb u have test page?

8

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.

9

alphanono wrote:

how can I find the ref of the node?

u can use same recursive function:

var someNode;
this.root.recursive(function(){
            if(this.isRoot()) return;
            if(this.data.id=='123') {
                   someNode=this;
                   return false;
            }
        });

10

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)

?

11

alphanono wrote:

That I want is to toggle all the nodes already loaded ! Is it possible ?

mb add isLoaded check? :-)

 this.root.recursive(function(){
            if(this.isRoot()) return;
            if(this.isLoaded()) this.toggle();
        });
alphanono wrote:

is it possible to force the selection of one element once the tree is reloaded ?

u want just select some node?

yourTree.select(someNode)

12

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

13

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 ?

14

use

this.toggle();// or this.toggle(true)

instead

 this.toggle(null, false);

it's demo mistake

If u want expand tree with forest=true try:

.addEvent('onLoad', function(){
        this.root.recursive(function(){
            if(this.isRoot()) return;
            this.toggle();
        });
    })

15

because u use forest=true, root node not exist