views:

138

answers:

1

Just out of curiosity, as I haven't been able to find anything anywhere; does anyone know of a way to get jQuery UI's sortable function to animate its sorting?

What I mean is, when you move an element around the sortable parent, its children, the sortables, skip around instead of smoothly animating to their new position, which besides from being an eyesore can also make it a bit difficult to figure out what has moved where.

There's obviously no default option for this, but I was hoping that perhaps someone, somewhere, had a neat solution.

+1  A: 

Sadly it's not possible at the moment, as the sortable code just updates the position of the elements. Though it refers to an this.options.custom, which perhaps allows for custom animation; though it's then totally undocumented/unsupported:

if(this.options.custom && this.options.custom.refreshContainers) {
    this.options.custom.refreshContainers.call(this);
} else {
    for (var i = this.containers.length - 1; i >= 0; i--){
        var p = this.containers[i].element.offset();
        this.containers[i].containerCache.left = p.left;
        this.containers[i].containerCache.top = p.top;
        this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
        this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
    };
}

Sadly I can't be of much more help; Haven't divulged myself into the sortable code much, so above code extract might be misleading.

azatoth
That's a good pointer. I'll have a look at that and see what that's about.
Heilemann