I would like to get the ID of the item that has been moved on the stop: function below? can someone explain how this is achieved in that function? I am new to JQuery so a good explanation of what is happening would be welcome. I have tried ui.helper.attr('id'); etc with no joy Thanks.
$(settings.columns).sortable({
items: $sortableItems,
connectWith: $(settings.columns),
handle: settings.handleSelector,
placeholder: 'widget-placeholder',
forcePlaceholderSize: true,
revert: 300,
delay: 100,
opacity: 0.8,
containment: 'document',
start: function (e,ui) {
$(ui.helper).addClass('dragging');
},
stop: function (e,ui) {
var col = ui.item.parent().parent().children().index(ui开发者_开发问答.item.parent());
var row = ui.item.parent().children().index(ui.item);
var movedID = ????
alert("ID: " + movedID); <-----------------------?
$(ui.item).css({width:''}).removeClass('dragging');
$(settings.columns).sortable('enable');
}
});
try to use $(ui.item).attr('id')
精彩评论