I'm attempting to create a case priority list for a client, and will be using Jquery UI
for the drag and drop feature.
The problem I am sitting with at the moment is finding out the new Index
of the list item
once it has been moved. I am hoping one of you has encountered this before or knows how I can get this? I am really struggling to find it.
I have tried lots of SO thread which say I should use .index()
, but i cant seem to get it working. Please see my attempt in this FIDDLE
$(document).ready(function () {
var Items = $("#SortMe li");
$('#SortMe').sortable({
disabled: false,
axis: 'y',
forceHelperSize: true,
update: function () {
var Newpos = $("li").index();
alert("You moved item to position " + Newpos);
}
}).disableSelection();
});
Once the list item
has been dropped, I would like to know its new position / index
so I can use this in SQL
later on in the process.
Thanks so much, Mike