<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Mifjs forum — Mif.Tree, Mif.Menu - Tree: sort after drag]]></title>
		<link>http://mifjs.net/forum/topic/218/</link>
		<description><![CDATA[The most recent posts in Tree: sort after drag.]]></description>
		<lastBuildDate>Fri, 02 Jul 2010 11:20:00 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Tree: sort after drag]]></title>
			<link>http://mifjs.net/forum/post/809/#p809</link>
			<description><![CDATA[Thx for your help,
I really appreciate it :)]]></description>
			<author><![CDATA[dummy@example.com (mrgroovy)]]></author>
			<pubDate>Fri, 02 Jul 2010 11:20:00 +0000</pubDate>
			<guid>http://mifjs.net/forum/post/809/#p809</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tree: sort after drag]]></title>
			<link>http://mifjs.net/forum/post/808/#p808</link>
			<description><![CDATA[to disable node drag set node.dragDisabled = true]]></description>
			<author><![CDATA[creavenmoro@gmail.com (moro)]]></author>
			<pubDate>Thu, 01 Jul 2010 10:07:55 +0000</pubDate>
			<guid>http://mifjs.net/forum/post/808/#p808</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tree: sort after drag]]></title>
			<link>http://mifjs.net/forum/post/807/#p807</link>
			<description><![CDATA[Absolutely awesome!, thx man :D
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:

[code]
onDrag: function(){
    if(dragIsDisabled)
    {
        this.where = 'notAllowed';
        this.emptydrop();
        return;
    }
}
[/code]]]></description>
			<author><![CDATA[dummy@example.com (mrgroovy)]]></author>
			<pubDate>Wed, 30 Jun 2010 20:56:55 +0000</pubDate>
			<guid>http://mifjs.net/forum/post/807/#p807</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tree: sort after drag]]></title>
			<link>http://mifjs.net/forum/post/806/#p806</link>
			<description><![CDATA[it don't work if sorted childrens have subchildrens, you can try this:
[code]
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);
[/code]
for tree (not forest)]]></description>
			<author><![CDATA[creavenmoro@gmail.com (moro)]]></author>
			<pubDate>Tue, 29 Jun 2010 21:54:21 +0000</pubDate>
			<guid>http://mifjs.net/forum/post/806/#p806</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tree: sort after drag]]></title>
			<link>http://mifjs.net/forum/post/805/#p805</link>
			<description><![CDATA[Thx for the respone!

Will try this out tomorrow,
now i need to sleep :)]]></description>
			<author><![CDATA[dummy@example.com (mrgroovy)]]></author>
			<pubDate>Tue, 29 Jun 2010 21:29:12 +0000</pubDate>
			<guid>http://mifjs.net/forum/post/805/#p805</guid>
		</item>
		<item>
			<title><![CDATA[Re: Tree: sort after drag]]></title>
			<link>http://mifjs.net/forum/post/804/#p804</link>
			<description><![CDATA[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:
[code]
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();
[/code]

and onDrop event or it'll use old parent]]></description>
			<author><![CDATA[creavenmoro@gmail.com (moro)]]></author>
			<pubDate>Tue, 29 Jun 2010 21:17:59 +0000</pubDate>
			<guid>http://mifjs.net/forum/post/804/#p804</guid>
		</item>
		<item>
			<title><![CDATA[Tree: sort after drag]]></title>
			<link>http://mifjs.net/forum/post/803/#p803</link>
			<description><![CDATA[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:
[code]
onComplete: function(){
    this.current.getParent().sort();
}
[/code]
Please help !
Thx]]></description>
			<author><![CDATA[dummy@example.com (mrgroovy)]]></author>
			<pubDate>Mon, 28 Jun 2010 19:38:41 +0000</pubDate>
			<guid>http://mifjs.net/forum/post/803/#p803</guid>
		</item>
	</channel>
</rss>

