should be dropDenied=['before', 'after'] and it's default property for root node.
All fields labelled (Required) must be completed before the form is submitted.
You are not logged in. Please login or register.
Mifjs forum — Mif.Tree, Mif.Menu » Help » Mif.Tree drag/drop: how to check of drag/drop for node is "allowed" » Post new reply
All fields labelled (Required) must be completed before the form is submitted.
should be dropDenied=['before', 'after'] and it's default property for root node.
Ah, ok, thanks for confirming.
One more question though! I added a if(target.isRoot()) return; in the onDrop event to prevent dropping on the root, forgetting about the dropDenied property. So I added a dropDenied=true to the root and noticed it didn't automatically expand my tree anymore (using a recursive on this.root and this.toggle). Is this standard behaviour or perhaps a "bug".
Nothing serious though, just didn't see it in the docs if it's default behavious or not (no time to check the source yet).
Cheers
in config you can only set dragDisabled and dropDenied properties. In other situations use onDrag event and change this.where. It's ok.
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...
Powered by PunBB