This project is archived and is in readonly mode.

#530 ✓duplicate
jmt_be

clone of sortable limited to offsetparent of list

Reported by jmt_be | March 1st, 2011 @ 05:28 PM | in 1.4.0.1 (closed)

http://jsfiddle.net/jmt_be/976fz/

When you try to drag an element from the first list to the second,
the clone disappears behind the second list.

In some other DOM settings, it might be clipped, preventing the drag
to remain visible past the boundaries of the offsetparent.

I believe there is a need to be able to have the clone generated with
position: fixed . Having a way to also control the zIndex might prove
useful. This could happen through options.

I toyed with the code of getClone in Sortable and got something like
this working (not with options yet):

getClone: function(event, element){
        if (!this.options.clone) return new Element(element.tagName).inject(document.body);
        if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list);
        var clone = element.clone(true).setStyles({
            margin: 0,
            // jmt / position: 'absolute',
            position: 'fixed', // jmt
            zIndex: 10000, // jmt
            visibility: 'hidden',
            width: element.getStyle('width')
        });
        //prevent the duplicated radio inputs from unchecking the real one
        if (clone.get('html').test('radio')){
            clone.getElements('input[type=radio]').each(function(input, i){
                input.set('name', 'clone_' + i);
                if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true);
            });
        }

        // jmt / return clone.inject(this.list).setPosition(element.getPosition(element.getOffsetParent()));
        return clone.inject(this.list).setPosition(element.getPosition(element.getOffsets())); // jmt
        
    },

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 »

The MooTools Extensions

People watching this ticket

Pages