-
Notifications
You must be signed in to change notification settings - Fork 997
Support for drop rejects with multiple rule-action sets #85
base: master
Are you sure you want to change the base?
Conversation
…ent, since $.browser is deprecated in jQuery 1.9.
… browsers. Removed the browser detection and switched the event.button to event.which. Thanks to estmatic for the advice!
Hey guys. How is this supposed to work actually? Is there an example how to use the reject option? Thanks! |
Hi @schneikai, the use of the reject option is quite simple but, indeed, not documented, here's an example : $('#nestable').nestable({
reject: [{
rule: function() { // The this object refers to dragRootEl i.e. the dragged element. The drag action is cancelled if this function returns true
return $(this).find('>ol>input input').length > 0; // The rule here is that it is forbidden to have nested inputs in the hierarchy
},
action: function(nestable) { // This optional function defines what to do when such a rule applies. The this object still refers to the dragged element, and nestable is, well, the nestable root element
alert('You can\'t do that !');
}
},
{ /* You can add another rule (and possibly an associated action) here */}
]
}); |
Nice! Thank you! |
Hi @bperel , i know this is an old branch but fit's my current project quite well. Do you know if it's also possible to reject something based on the destination it's moved to? |
@sebVier I'll check this in the next days |
Awesome thanks a lot! |
@sebVier I had a look at this. You may have been confused by the inaccurate comments that I put on my code. I fixed that and updated from upstream into https://github.com/bperel/Nestable. Demo is on http://bperel.github.com/Nestable/ |
@bperel Thank you so much! work's great now! |
@bperel so good. |
@bperel Thanks you for this solution. 👍 |
No description provided.