aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2022-05-19 11:11:16 +0300
committerBonfaceKilz2022-05-27 15:17:52 +0300
commitcca83b1826dc84869f7ad985724ae034c4a0433d (patch)
tree3a52d48918d5168337bdaf1ffc6c6779b0d500a9
parentc8c298203841b88ee70cdd1dc3eba4426ca41e7b (diff)
downloadgenenetwork2-cca83b1826dc84869f7ad985724ae034c4a0433d.tar.gz
Add js logic to make a POST request on Deletion
* wqflask/wqflask/templates/case_attributes.html: When deleting a case-attribute, make a POST request.
-rw-r--r--wqflask/wqflask/templates/case_attributes.html17
1 files changed, 17 insertions, 0 deletions
diff --git a/wqflask/wqflask/templates/case_attributes.html b/wqflask/wqflask/templates/case_attributes.html
index d64efd0f..756c3a68 100644
--- a/wqflask/wqflask/templates/case_attributes.html
+++ b/wqflask/wqflask/templates/case_attributes.html
@@ -257,10 +257,27 @@
$(this).parents("tr").find(".add, .edit").toggle();
$(".add-new").attr("disabled", "disabled");
});
+
// Delete row on delete button click
$(document).on("click", ".delete", function(){
$(this).parents("tr").remove();
$(".add-new").removeAttr("disabled");
+ let node = $(this).parents("tr")
+
+ let diff = {};
+ diff["Deletion"] = {
+ name: node.find(".name").data("original-value"),
+ description: node.find(".description").data("original-value"),
+ id: node.data("id")}
+ console.log(diff)
+ $.ajax({
+ type: "POST",
+ data: {"data": JSON.stringify(diff)},
+ url: '{{ url_for("metadata_edit.update_case_attributes") }}',
+ success: function(data, status, xhr) {
+ location.reload();
+ }
+ });
});
});
</script>