 
     # Move line to one row up by modifying model collection.
     onUpButtonClicked: (event) =>
-        newIndex = (@list.$el.children('.task').index @$el) - 1
-        @onReorder @, newIndex if newIndex? and newIndex >= 0
+        @onDescriptionChanged null, -1,
+            success: =>
+                newIndex = (@list.$el.children('.task').index @$el) - 1
+                @onReorder @, newIndex if newIndex? and newIndex >= 0
 
     # Move line to one row down by modifying model collection.
     onDownButtonClicked: (event) =>
-        tasks = @list.$el.children('.task')
-        taskListLength = tasks.length
-        newIndex = (tasks.index @$el) + 2
-        @onReorder @, newIndex if newIndex? and newIndex <= taskListLength
+        @onDescriptionChanged null, -1,
+            success: =>
+                tasks = @list.$el.children('.task')
+                taskListLength = tasks.length
+                newIndex = (tasks.index @$el) + 2
+                @onReorder @, newIndex if newIndex? and \
+                                          newIndex <= taskListLength
 
     # When description is changed, model is saved to backend.
-    onDescriptionChanged: (event, keyCode) =>
+    onDescriptionChanged: (event, keyCode, callback) =>
         unless keyCode == 8 or @descriptionField.val().length == 0
             @saving = true
             @model.description = @descriptionField.val()

        @list.draggedItem = null

    onReorder: (draggedItem, newIndex) ->
        #console.debug newIndex
        if not @list.isSaving
            isReordered = @model.collection.reorder draggedItem.model, newIndex

            if @model.collection.listId? and isReordered
                @list.isSaving = true
                draggedItem.showLoading()
                childrenTasks = @list.$el.children('.task')
                oldIndex = childrenTasks.index(draggedItem.$el)


    # Display loading indicator inside todo/done button and hide button text.
    showLoading: ->
        #@hideLoading()
        @todoButton.html "&nbsp;"
        @todoButton.spin "tiny"

