Hello Sebastien,

I finally was able to get back to this task :))))
Thanks a lot for the pointer! it turns out I have already implemented
"revert" function, but completely forgot about it :(
now everything works as expected

Thanks!

On Fri, Jun 3, 2016 at 6:06 PM, Sebastien <[email protected]> wrote:

> Hi Maxim,
>
> After a quick test, 'revert' and 'accept' are enough (and convenient if you
> have a css class for 'file'). But using 'scope' instead of 'accept' also
> works, it's up to you...
> I also confirm you that revert does not prevent #onDrop to be fired (even
> used as a function)...
>
> For instance:
>
> - the droppable
>
>     private Droppable<String> newDroppable(String id, String color, final
> String scope)
>     {
>         return new Droppable<String>(id, Model.of(color)) {
>
>             @Override
>             public void onConfigure(JQueryBehavior behavior)
>             {
>                 super.onConfigure(behavior);
>
>                 // behavior.setOption("scope", Options.asString(scope));
>                 behavior.setOption("accept", Options.asString("." +
> scope)); // css class
>             }
> }
>
> - the draggable
>
>     private static Draggable<String> newDraggable(String id, String label,
> final String scope)
>     {
>         return new Draggable<String>(id, Model.of(label)) {
>
>             @Override
>             public void onConfigure(JQueryBehavior behavior)
>             {
>                 super.onConfigure(behavior);
>
>                 // behavior.setOption("scope", Options.asString(scope));
>                 behavior.setOption("revert", true); // or:
>                 // behavior.setOption("revert", "function(e) {
>                 // console.log('e', e); // e stands for the droppable
>                 // console.log('this', this); // this stands for the
> draggable
>                 // if (this.hasClass('file')) { return true; } }"); // true
> means "do revert"
>             }
>         };
>     }
>
> - html
>
>             < div wicket:id="draggable1" class="file">
>                 my file
>             < /div>
>             < div wicket:id="draggable2" class="folder">
>                 my folder
>             < /div>
>
>
> Hope this helps,
> Sebastien
>
>
> On Fri, Jun 3, 2016 at 10:03 AM, Maxim Solodovnik <[email protected]>
> wrote:
>
> > Thanks a lot!
> > I'll be on vacation next couple of week, will try to test on return :)
> >
>



-- 
WBR
Maxim aka solomax

Reply via email to