diff --git a/src/ajax.php b/src/ajax.php index cb4c742..88d8b73 100644 --- a/src/ajax.php +++ b/src/ajax.php @@ -206,7 +206,8 @@ elseif(isset($_GET['completeTask'])) array($dateCompleted, time()) ); $t = array(); $t['total'] = 1; - $t['list'][] = array('id'=>$id, 'compl'=>$compl, 'ow'=>$ow, 'dateCompleted'=>$dateCompleted?htmlarray(timestampToDatetime($dateCompleted)):''); + $r = $db->sqa("SELECT * FROM {$db->prefix}todolist WHERE id=$id"); + $t['list'][] = prepareTaskRow($r); echo json_encode($t); exit; } diff --git a/src/mytinytodo.js b/src/mytinytodo.js index 3e0a533..eea59ae 100644 --- a/src/mytinytodo.js +++ b/src/mytinytodo.js @@ -1149,9 +1149,7 @@ function completeTask(id, ch) var item = json.list[0]; if(item.compl) $('#taskrow_'+id).addClass('task-completed'); else $('#taskrow_'+id).removeClass('task-completed'); - taskList[id].ow = item.ow; - taskList[id].compl = item.compl; - taskList[id].dateCompleted = item.dateCompleted; + taskList[id] = item; changeTaskCnt(taskList[id], 0); if(item.compl && !curList.showCompl) { delete taskList[id]; @@ -1159,8 +1157,9 @@ function completeTask(id, ch) $('#taskrow_'+id).fadeOut('normal', function(){ $(this).remove() }); } else if(curList.showCompl) { - $('#taskrow_'+id).fadeOut('fast', function(){ - changeTaskOrder(id); + $('#taskrow_'+item.id).replaceWith(prepareTaskStr(taskList[id])); + $('#taskrow_'+id).fadeOut('fast', function(){ + changeTaskOrder(id); $(this).effect("highlight", {color:_mtt.theme.editTaskFlashColor}, 'normal', function(){$(this).css('display','')}); }); }