added an switch to reset the data if the thing is moved into the original group
This commit is contained in:
parent
cf161cb8cf
commit
990be921f3
1 changed files with 7 additions and 2 deletions
|
|
@ -12,13 +12,18 @@ $(function() {
|
||||||
$(".group ul").droppable({
|
$(".group ul").droppable({
|
||||||
|
|
||||||
drop: function(event, ui) {
|
drop: function(event, ui) {
|
||||||
$(this).closest("ul").append(ui.draggable)
|
|
||||||
//$("<li class='person ui-draggable'></li>").text(ui.draggable.text()).appendTo(this).draggable();
|
//$("<li class='person ui-draggable'></li>").text(ui.draggable.text()).appendTo(this).draggable();
|
||||||
var move = {};
|
var move = {};
|
||||||
move[ 'friend_id' ] = ui.draggable[0].id
|
move[ 'friend_id' ] = ui.draggable[0].id
|
||||||
move[ 'to' ] = $(this)[0].id;
|
move[ 'to' ] = $(this)[0].id;
|
||||||
move[ 'from' ] = ui.draggable[0].getAttribute('from_group_id');
|
move[ 'from' ] = ui.draggable[0].getAttribute('from_group_id');
|
||||||
$('#group_list').data( ui.draggable[0].id, move);
|
if (move['to'] == move['from']){
|
||||||
|
$('#group_list').data( ui.draggable[0].id, []);
|
||||||
|
} else{
|
||||||
|
$('#group_list').data( ui.draggable[0].id, move);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).closest("ul").append(ui.draggable)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue