diff options
Diffstat (limited to 'uploader/static/js/species.js')
-rw-r--r-- | uploader/static/js/species.js | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/uploader/static/js/species.js b/uploader/static/js/species.js index 1f2aa3b..c1374c6 100644 --- a/uploader/static/js/species.js +++ b/uploader/static/js/species.js @@ -1,19 +1,10 @@ -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: [ +$(() => { + dtAddCommonHandlers("#tbl-select-species"); + 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 +17,5 @@ var speciesDataTable = (speciesdata) => { return `${aspecies.FullName} (${aspecies.SpeciesName})`; } } - ] - }); -}; - -$(() => { - dtAddCommonHandlers("#tbl-select-species"); - speciesDataTable(JSON.parse( - $("#tbl-select-species").attr("data-species-list"))); + ]); }); |