I'm trying to make my jQuery ui autocomplete results draggable. Although I already tried several ways it is still not working. I need to costimze the initialisation of each draggable element, so unfortunately this is not useful to me.
Here is my approach: (Simplified)
_renderItemData : function (ul, item) {
return $("<li />")
.data("ui-autocomplete-item", item)
.append("<a id='SearchResult"+item.number+"'><div style='vertical-align:middle;line-height:25px;font-size:25px;'><img src='" + item.icon + "' style='width:25px;position:relative;top:2.5px;'/><span style=''>" +item.label + "</span></div></a>")
.appendTo(ul);
$("#SearchResult"+item.number)
.draggable({
helper:"clone",
stop: function( event, ui ) {
alert("Dropped");
doSomethingAndPassElementNumber(item.number);
}
});
},
Does anybody know how I can achieve my goal?
Thanks in advance! If there are any questions please ask, I'm grateful for every useful advicce!