Topic: Mif.Tree drag/drop: how to check of drag/drop for node is "allowed"
Hi,
Let me start with saying I really dig Mif.Tree
I haven't had a chance yet to fully explore it, however I like it so far.
I have a question what is the appropriate way to check for an "allowable" drag/drop.
Say I want to use Mif.Tree for a page structure representation (e.g. in a site map or navigation).
Ideal would be that we could set rules like:
- Allow drag/drop in node X for all it's sub nodes
- Allow drag/drop in node groups W, X and Z
I understand this is a bit much to ask
My current case is that I have a root with several nodes (main pages) and some have sub nodes (sub pages). I would to activate drag/drop in these sub nodes for setting a sort order.
I have a check now like this to make this work, however, I wonder if this is "OK"... any advice/ideas/tips..?
onDrag: function() {
if(this.target && (
this.target.getParent().isRoot() ||
(this.target.getParent() != this.current.getParent()) ||
(this.target.getParent() == this.current.getParent() && this.where == 'inside')
)) {
this.where = 'notAllowed';
}
}It feels a bit "hacked", even though for my situation it works. I was wonder if I could add more controls/rules regarding drag/drop in some sort of config setting perhaps...