about summary refs log tree commit diff
path: root/uploader/static/js/populations.js
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/static/js/populations.js')
-rw-r--r--uploader/static/js/populations.js33
1 files changed, 8 insertions, 25 deletions
diff --git a/uploader/static/js/populations.js b/uploader/static/js/populations.js
index 5c1f848..73e298a 100644
--- a/uploader/static/js/populations.js
+++ b/uploader/static/js/populations.js
@@ -1,19 +1,10 @@
-var populationDataTable = (populationdata) => {
-    var lengthMenu = [10, 25, 50, 100, 1000];
-    if(populationdata.length > 1000) {
-        lengthMenu.push(populationdata.length)
-    }
-    $("#tbl-select-population").DataTable({
-        responsive: true,
-        lengthMenu: lengthMenu,
-        language: {
-            processing: "Processing… Please wait.",
-            loadingRecords: "Loading population — Please wait.",
-            lengthMenu: "Show _MENU_ populations",
-            info: "Showing _START_ to _END_ of _TOTAL_ populations"
-        },
-        data: populationdata,
-        columns: [
+$(() => {
+    dtAddCommonHandlers("#tbl-select-population");
+    var populationsDataTable = buildDataTable(
+        "#tbl-select-population",
+        JSON.parse(
+            $("#tbl-select-population").attr("data-populations-list")),
+        [
             {
                 data: (apopulation) => {
                     return `<input type="radio" name="population_id"`
@@ -27,13 +18,5 @@ var populationDataTable = (populationdata) => {
                     return `${apopulation.FullName} (${apopulation.InbredSetName})`;
                 }
             }
-        ]
-    });
-};
-
-
-$(() => {
-    dtAddCommonHandlers("#tbl-select-population");
-    populationDataTable(JSON.parse(
-        $("#tbl-select-population").attr("data-populations-list")));
+        ]);
 });