Make a document level event handler for clicking on tasks in the list instead of rebuilding it every refresh
This commit is contained in:
parent
dc52cc86f6
commit
fdea1600f3
|
|
@ -12,7 +12,7 @@ $(document).ready(function() {
|
|||
$("#filter_reset").on("click", function() { $("#form_filter").val(""); });
|
||||
$("#panelimg").on("click", function() { updateImage(); });
|
||||
$("#tab-tasks").on("click", function() { getTasks(); });
|
||||
//$("#tabs").on("tabsactivate", function(event, ui) { console.log($("#tabs").tabs('option', 'active')); });
|
||||
$("#tasklist").on("click", ".task", function() { editTask(this.dataset.id); });
|
||||
getTasks();
|
||||
let chartOptions = {
|
||||
chart: {
|
||||
|
|
@ -212,7 +212,7 @@ function getTasks() {
|
|||
$("#form_showall").prop('checked', data.showalltasks);
|
||||
let show = "";
|
||||
data.tasks.forEach(function(task, index) {
|
||||
show += "<div class='task' id='task_" + task.id + "'>";
|
||||
show += "<div class='task' data-id='" + task.id + "'>";
|
||||
show += "<div><span class='strongtext'>Title: </span>" + task.title_safe + "</div>";
|
||||
show += "<div><span class='strongtext'>Description: </span>" + task.description_safe + "</div>";
|
||||
show += "<div><span class='strongtext'>Priority: </span>" + task.priority + "</div>";
|
||||
|
|
@ -222,11 +222,6 @@ function getTasks() {
|
|||
show += "</div>";
|
||||
});
|
||||
$("#tasklist").html(show);
|
||||
data.tasks.forEach(function(task, index) {
|
||||
$("#task_"+task.id).click(function() {
|
||||
editTask(task.id);
|
||||
});
|
||||
});
|
||||
},
|
||||
error: function(jqo, stat, error) {
|
||||
toastr.error("Could not communicate with server!", "Server Error");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user