This project is archived and is in readonly mode.

#59 ✓duplicate
Thomas Aylott

Sortables sort logic bug

Reported by Thomas Aylott | May 28th, 2008 @ 10:06 AM

Originally posted on Trac by KnownWanderer

Original Trac Ticket

Description

Apologies if this has already been addressed.

I am testing build 1520 currently.

If appears that if an element in a Sortable is thinner than its counterparts then the sort logic produces unexpected results (from a user perspective).

Consider the following:

var container = new Element('div').inject(document.body);
$A([200,20,200]).each(function(value, index) {
    new Element('div', {
        'styles': {
            'background-color':[100,100,value],
            'width':100,
            'height':value,
            'border':'1px solid rgb(80,80,80)',
            'cursor':'move'
        } 
    }).set('text','element'+index.toString()).inject(container);
});

var sortable = new Sortables(container, {clone: true});

If you drag the middle element (element1) down over element2 then it is positioned correctly. However, if you reverse the drag direction without first leaving element2 and drag element1 up over element0 it snaps to the top of element0 as opposed to the more expected middle position. This seems to be due to the logic of sorting onEnter only that is present in the Sortables.

Let me know if more of an explanation is required.

Trac Attachments

Trac Comments

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Tags

Pages