aboutsummaryrefslogtreecommitdiff
path: root/uploader/static/js/species.js
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/static/js/species.js')
-rw-r--r--uploader/static/js/species.js45
1 files changed, 21 insertions, 24 deletions
diff --git a/uploader/static/js/species.js b/uploader/static/js/species.js
index 1f2aa3b..d42e081 100644
--- a/uploader/static/js/species.js
+++ b/uploader/static/js/species.js
@@ -1,19 +1,9 @@
-var speciesDataTable = (speciesdata) => {
- var lengthMenu = [10, 25, 50, 100, 1000];
- if(speciesdata.length > 1000) {
- lengthMenu.push(speciesdata.length)
- }
- $("#tbl-select-species").DataTable({
- responsive: true,
- lengthMenu: lengthMenu,
- language: {
- processing: "Processing… Please wait.",
- loadingRecords: "Loading species — Please wait.",
- lengthMenu: "Show _MENU_ species",
- info: "Showing _START_ to _END_ of _TOTAL_ species"
- },
- data: speciesdata,
- columns: [
+$(() => {
+ var speciesDataTable = buildDataTable(
+ "#tbl-select-species",
+ JSON.parse(
+ $("#tbl-select-species").attr("data-species-list")),
+ [
{
data: (aspecies) => {
return `<input type="radio" name="species_id"`
@@ -26,12 +16,19 @@ var speciesDataTable = (speciesdata) => {
return `${aspecies.FullName} (${aspecies.SpeciesName})`;
}
}
- ]
- });
-};
-
-$(() => {
- dtAddCommonHandlers("#tbl-select-species");
- speciesDataTable(JSON.parse(
- $("#tbl-select-species").attr("data-species-list")));
+ ],
+ {
+ select: "single",
+ paging: true,
+ scrollY: 700,
+ deferRender: true,
+ scroller: true,
+ scrollCollapse: true,
+ layout: {
+ topStart: "info",
+ topEnd: "search",
+ bottomStart: "pageLength",
+ bottomEnd: false
+ }
+ });
});