Skip to forum content
Mif
— mystic javascript interface
You are not logged in. Please login or register.
Active topics Unanswered topics
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.
Topic review (newest first)
first I'd like to say thanks you for all the contributions in this pose - helps me alot
though just one extra thing to moro's solution
if sorting from tree.root (with foreset), I needed to change following line
var childrenEl = parent.getDOM('children');
to this
if (parent == self.tree.root){
var childrenEl = self.tree.container.getElement('.mif-tree-children-root')
}
else{
var childrenEl = parent.getDOM('children');
}
otherwise miftree will complain when you try to call getDOM()
Thx for your help,
I really appreciate it 
to disable node drag set node.dragDisabled = true
Absolutely awesome!, thx man 
should make this a feature 
I have another question:
Sometimes i want to cancel a drag action.
I should explain my situation:
Nodes in the tree represent site content,
when a node is selected the content of that node will be displayed in a form.
So when the user edits the form and clicks on another node i display a overlay
with a message like "There are unsaved changes, save YES / NO".
The overlay will show on mousedown (the select event).
And if the user keeps the mouse button down and moves the mouse he will drag the node
behind the overlay.
So my question is:
Is it possible to cancel the current drag action ?
Tried this:
onDrag: function(){
if(dragIsDisabled)
{
this.where = 'notAllowed';
this.emptydrop();
return;
}
}
it don't work if sorted childrens have subchildrens, you can try this:
var parent = this.current.getParent();
parent.sort(function(node1, node2){
if(node1.name>node2.name){
return 1;
}else if(node1.name<node2.name){
return -1;
}else{
return 0;
}
});
var childrenEl = parent.getDOM('children');
for(var i = 0, l = parent.children.length; i < l; i++){
parent.children[i].getDOM('node').inject(childrenEl);
Mif.Tree.Draw.update(parent.children[i]);
}
parent.tree.$getIndex();
this.current.tree.scrollTo(this.current);
for tree (not forest)
Thx for the respone!
Will try this out tomorrow,
now i need to sleep 
yes this don't work, sort really don't sort nodes :-). It used internally with sortable tree, when all nodes sorted.
You can try this:
Mif.Tree.Node.implement({
redraw: function() {
this.$draw = false;
this.tree.$getIndex();
this.getDOM('children').innerHTML = '';
Mif.Tree.Draw.update(this);
return this;
}
});
this.current.getParent().sort(function(node1, node2){
if(node1.name > node2.name){
return 1;
}else if(node1.name < node2.name){
return -1;
}else{
return 0;
}
});
this.current.getParent().redraw();
and onDrop event or it'll use old parent
Hello, first of all: the plugin is awesome, really like it alot.
My question: how to use sorting in combination with drag and drop.
tried something like this:
onComplete: function(){
this.current.getParent().sort();
}
Please help !
Thx