views:

24

answers:

2

Hi,

I got the following setup for dragdrop functionality:

const listDragOptions = {
    handle: ".camera, .texter", // dragged by either camera or edit icon
    //revert: true, // so dragged elements fall back to their original position,
    revertDuration: 200, // the element goes back instantly, no need for effects on this one
    snap: true, // snap to table cell edges
    helper: "clone", // create a cloned element instead of moving the original one
    drag: function(event, ui) {
        // tell me which handle is being used!
    }
}

Basically I need to know which of the two handles ".camera, .texter" the user has clicked to achieve ddragging functionality. This seems tricky. I can't find anything in the API, so I'm really willing to accept any dirty hack.

Thanks for all answers!

+1  A: 

I've not had chance to test this, but are you able to grab the id using -

$(ui.draggable).attr("id")
Tom
A: 

Unfortunately, this doesn't help. I need to know which handler inside the ui.draggable (or actually: ui.helper) element is being used. Pseudo-Code:

$(":handler", ui.helper).attr("id"); // returns the id of the handler currently used to move the element

However I have solved the problem by just adding another draggable element. It's too bad though.

Dom