From 8b4b665b8028879080bcaabe4fe8288bb512d182 Mon Sep 17 00:00:00 2001
From: Frederick Muriuki Muriithi
Date: Wed, 5 Apr 2023 04:39:45 +0300
Subject: oauth2: UI - Autoselect on user click
Try auto-selecting datasets on user click: not successful at this
point.
There are some weird bugs with the DataTables that I have not been
able to resolve yet.
---
.../templates/oauth2/data-list-genotype.html | 39 ++++++++++++++++++----
1 file changed, 32 insertions(+), 7 deletions(-)
diff --git a/wqflask/wqflask/templates/oauth2/data-list-genotype.html b/wqflask/wqflask/templates/oauth2/data-list-genotype.html
index 647597fd..54c2a9fd 100644
--- a/wqflask/wqflask/templates/oauth2/data-list-genotype.html
+++ b/wqflask/wqflask/templates/oauth2/data-list-genotype.html
@@ -113,6 +113,9 @@
src="/js/DataTablesExtensions/colResize/dataTables.colResize.js">
+
+
@@ -125,17 +128,23 @@
{"title": "Dataset ShortName", "data": "dataset_shortname"}
];
- var search_column_definitions = [{"data": null, "render": function(data) {
- return (
- '');
+ var search_column_definitions = [{"data": null, "render": function(data, type, row, meta) {
+ new_check = $('');
+ /* =================== BUG ===================
+ data changes with the multiple calls and is missing some key/value
+ pairs, i.e. SpeciesId, InbredSetId, GenoFreezeId
+ No idea why.
+ */
+ new_check.val(JSON.stringify(data));
+ // new_check.val(data.SpeciesId + ':' + data.InbredSetId + ':' + data.GenoFreezeId);
+ return new_check[0].outerHTML;
}},].concat(common_column_definitions);
var selected_column_definitions = [{"data": null, "render": function(data) {
return (
'');
}},].concat(common_column_definitions);
@@ -165,7 +174,23 @@
});
/* $("#txt-query").keyup(debounced_search()); */
render_table("tbl-genotypes", "data-datasets");
- render_table("tbl-link-genotypes", "data-selected-datasets")
+ render_table("tbl-link-genotypes", "data-selected-datasets");
+ $(".search-checkbox").change(function(event) {
+ if(this.checked) {
+ selected = JSON.parse(
+ $("#tbl-link-genotypes").attr("data-selected-datasets"));
+ this_item = JSON.parse(this.value);
+ selected.push(this_item);
+ $("#tbl-link-genotypes").attr(
+ "data-selected-datasets", JSON.stringify(selected));
+ /* Remove from source table */
+ /* Re-render tables */
+ console.debug("STARTING RE-RENDER ...");
+ render_table("tbl-genotypes", "data-datasets");
+ render_table("tbl-link-genotypes", "data-selected-datasets");
+ console.debug("RE-RENDER COMPLETE ...");
+ }
+ });
});
{%endblock%}
--
cgit v1.2.3