aboutsummaryrefslogtreecommitdiff
path: root/uploader/templates/phenotypes
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-03-11 16:50:04 -0500
committerFrederick Muriuki Muriithi2025-03-11 16:58:43 -0500
commitcfa33d211372d40edcd35d2c0d74daf261fe6bf3 (patch)
tree9de7a84e4e87c693d7b54ca2ac4271e720313a7d /uploader/templates/phenotypes
parentef71af77671669531bbc07c7363511117b7d13e9 (diff)
downloadgn-uploader-cfa33d211372d40edcd35d2c0d74daf261fe6bf3.tar.gz
Extract common DataTables into a reusable function.
Diffstat (limited to 'uploader/templates/phenotypes')
-rw-r--r--uploader/templates/phenotypes/view-dataset.html39
1 files changed, 10 insertions, 29 deletions
diff --git a/uploader/templates/phenotypes/view-dataset.html b/uploader/templates/phenotypes/view-dataset.html
index 833ca12..f171483 100644
--- a/uploader/templates/phenotypes/view-dataset.html
+++ b/uploader/templates/phenotypes/view-dataset.html
@@ -96,21 +96,10 @@
dtAddCommonHandlers("#tbl-phenotypes-list");
var data = {{phenotypes | tojson}};
- var dtPhenotypesList = $("#tbl-phenotypes-list").DataTable({
- select: true,
- select: {
- selector: "td:first-child.chk-row-select"
- },
- scroller: true,
- sDom: "iti",
- scrollY: "100vh",
- scrollCollapse: true,
- responsive: true,
- data: data,
- rowId: function(pheno) {
- return `${pheno.InbredSetCode}_${pheno.xref_id}`;
- },
- columns: [
+ var dtPhenotypesList = buildDataTable(
+ "#tbl-phenotypes-list",
+ data,
+ [
{
data: function(pheno) {
return `<input type="checkbox" name="selected-phenotypes" `
@@ -142,20 +131,12 @@
}
}
],
- drawCallback: function(settings) {
- $(this[0]).find("tbody tr").each((idx, row) => {
- var arow = $(row);
- var checkboxOrRadio = arow.find(".chk-row-select");
- if (checkboxOrRadio) {
- if (arow.hasClass("selected")) {
- checkboxOrRadio.prop("checked", true);
- } else {
- checkboxOrRadio.prop("checked", false);
- }
- }
- });
- }
- });
+ {
+ // select: true, // extension is causing trouble.
+ rowId: function(pheno) {
+ return `${pheno.InbredSetCode}_${pheno.xref_id}`;
+ }
+ });
$("#btn-phenotypes-list-select-all").on("click", (event) => {
dtPhenotypesList.rows().select();