From e0b372c0ba5748e378919e55900220112575b583 Mon Sep 17 00:00:00 2001 From: Jonas Suhr Christensen Date: Sun, 11 Mar 2012 11:39:35 +0100 Subject: Fixed drag and drop problem by stopping propagation of the event. + some non-finished updatign code. --- proto.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'proto.js') diff --git a/proto.js b/proto.js index 5d855b0..f0aa571 100644 --- a/proto.js +++ b/proto.js @@ -172,8 +172,6 @@ try { var title = msg[2]; var description = msg[3]; var parent_id = msg[4]; -// var left = msg[4]; -// var top = msg[5]; var task = document.createElement("div"); task.name = "task"; @@ -187,8 +185,9 @@ try { task.id = "task_" + id; var taskText = document.createTextNode(title + ": " + description + " :" + task.id); - task.appendChild(taskText); - + taskText.id = "txt"; + task.appendChild(taskText); + // task.style.position = "absolute"; // task.style.left = left + "px"; // task.style.top = top + "px"; @@ -201,7 +200,7 @@ try { // dlButton.setAttribute("onclick", "deleteTask(" + id +")"); // task.appendChild(dlButton); - document.body.appendChild(task); +// document.body.appendChild(task); var parent_task = document.getElementById("task_" + parent_id); @@ -212,6 +211,16 @@ try { document.body.appendChild(task); } } + else if(cmd == "update") { + var id = msg[1]; + var title = msg[2]; + var description = msg[3]; + + var task = document.getElementById("task_" + id); + + var taskText = document.createTextNode(title + ": " + description + " :" + task.id); + task.appendChild(taskText); + } f++; // document.getElementById("box").style.top = i[3] + "px"; // document.getElementById("box").style.left = i[2] + "px"; @@ -282,6 +291,7 @@ function deleteTask(id) { function drag(target, e) { e.dataTransfer.setData('Text', target.id); + e.stopPropagation(); // <--- this fixes the drag target problem } function drop(target, e) { -- cgit v1.2.3