tags:

views:

20

answers:

0

Hi,

I am using the jquery-ui library. I have two sortables. I want to know the index of the dragged source item. I have something like this:

$(function() {
    $("#sortable1, #sortable2").sortable({
        connectWith: '.connectedSortable'
    }).disableSelection();

    $("#sortable1").sortable({
        start: function(event, ui) {
            alert(ui.position);
        }
    });
});

if I'm reading the docs correctly, then ui.position should be what I want?:

ui.position - current position of the helper

but when I jsut try printing it: alert(ui.position) it seems to be empty.

I am doing all of this in an attempt to emulate cloning.

docs: http://jqueryui.com/demos/sortable/#event-activate

------------ Edit ----------------------------------

Actually this is kind of what I need to do (just get the index of the dragged item: http://dev.jqueryui.com/ticket/2730

but it doesn't seem to work (just tried the final solution at the bottom), keep getting index of -1. Any ideas on this would be great,

Thanks