diff options
author | Alexander_Kabui | 2024-05-29 14:27:40 +0300 |
---|---|---|
committer | Alexander_Kabui | 2024-05-29 14:27:40 +0300 |
commit | 842a758f31143a5934b2798a4d0f40f11a402919 (patch) | |
tree | bebe24b041a1118878a0b086856415b1bea48eeb /gn2/wqflask/templates/gnqa_search_history.html | |
parent | 30e5a84940bd9715bea02d07c5092bbfd717f7c5 (diff) | |
download | genenetwork2-842a758f31143a5934b2798a4d0f40f11a402919.tar.gz |
Add htmx js api for delete functionality.
Diffstat (limited to 'gn2/wqflask/templates/gnqa_search_history.html')
-rw-r--r-- | gn2/wqflask/templates/gnqa_search_history.html | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/gn2/wqflask/templates/gnqa_search_history.html b/gn2/wqflask/templates/gnqa_search_history.html index c1e66541..976fd7fd 100644 --- a/gn2/wqflask/templates/gnqa_search_history.html +++ b/gn2/wqflask/templates/gnqa_search_history.html @@ -1,4 +1,4 @@ -<section class="container-fluid gnqa-copy"> +<section class="container-fluid gnqa-copy" id="search-hist"> <header class="row"> <div class="panel panel default col-sm-6 col-sm-offset-3"> <div class="panel panel-default"> @@ -15,8 +15,8 @@ <div class="col-sm-6 col-sm-offset-3" style="margin-bottom:10px"> <button type="button" class="btn btn-danger" id="delete-btn">Delete Selected </button> </div> - <div> - <div class="panel panel-default col-sm-6 col-sm-offset-3 "> + <div > + <div class="panel panel-default col-sm-6 col-sm-offset-3 "> <div> <ul class="list-group list-group-flush" style="overflow-y:scroll"> {% for item in prev_queries %} @@ -44,15 +44,9 @@ </div> </div> </section> -{% block js %} - <script> +<script> htmx.on("#delete-btn", "click", function(evt){ - // todo: complete this for delete /export functionality - htmx.ajax("POST", "/gnqna/hist", {target:"", - swap:"innerHTML",values: - Array.from(htmx.findAll("input[type=checkbox]:checked"), e => e.value);} - ) + htmx.ajax("DELETE","/gnqna/hist", {target: "#search-hist","swap" :"outerHTML", + values: Array.from(htmx.findAll("input[type=checkbox]:checked"), e => e.value)}) }) </script> - -{% endblock %} |