Re: Sortable trouble

Siegfried Puchbauer
2006-03-07T12:57:01Z

Hi

I discovered the same behaviour, see http://dev.rubyonrails.org/ticket/3391

A simple workarount is to include a reverteffect to the options, which
clears style.top and style.left of the element

for example:

Sortable.create(...., {
...
      reverteffect: function(e) {
        e.style.top  = 0;
        e.style.left = 0;
      },
...
});

this function returns the draggables to their right position
immediatly after the mouse is released,
without any Move Effect

You could also try to modify the original reverteffect of the
draggables, I haven''t done this so far.

smth like this:

 reverteffect: function(element, top_offset, left_offset) {
        var dur Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
        element._revert = new Effect.Move(element, { x: -left_offset,
y: -top_offset, duration: 500,
             afterFinish: function(e) {
                  e.style.top  = 0;
                  e.style.left = 0;
              }
           });
        }


hth

On 3/7/06, Alexander Presber
<aljoscha-xietgXKonlNn68oJJulU0Q@public.gmane.org>
wrote:
>
> Hi everybody,
>
> Could somebody have a look at a little sortable example at
>
> http://www.weisshuhn.de/diagnose/sortable.html
>
> It implements two Sortables and a Draggable. You can drag elements
> from the "source" Sortable to the main Sortable, sort them
(surprise)
> and drag them to a trash. Whenever you drag from the "source", a
new
> element is created (by cloning an invisible element) in the
"source".
>
> There is a problem though: The dynamically created elements do not
> always slide to their correct positions when moved for the second or
> third time and keep their wrong offset ever after.
>
> Since I kept close to the original two-Sortable demo from the
> webside, I can only assume, this is a bug or unthought-of case in the
> scriptaculous lib.
>
> It happens on IE, Mozilla and Safari.
>
> Any comments are highly welcome.
>
> Alexander Presber
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>



--
Mit freundlichen Grüßen

Siegfried Puchbauer


_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org