diff options
Diffstat (limited to 'uploader/static')
-rw-r--r-- | uploader/static/js/datatables.js | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/uploader/static/js/datatables.js b/uploader/static/js/datatables.js index 9782a60..f93fdee 100644 --- a/uploader/static/js/datatables.js +++ b/uploader/static/js/datatables.js @@ -77,19 +77,26 @@ var defaultLengthMenu = (data) => { var buildDataTable = (tableId, data = [], columns = [], userSettings = {}) => { var defaultSettings = { responsive: true, + layout: { + topStart: null, + topEnd: null, + bottomStart: null, + bottomEnd: null, + }, + select: true, /* == Scroller settings == */ scroller: true, paging: true, // MUST be true for scroller to work - sDom: "iti", - scrollY: "100vh", + scrollY: "750px", scrollCollapse: true, + deferRender: true, /* == END: Scroller settings == */ lengthMenu: defaultLengthMenu(data), language: { processing: "Processing… Please wait.", - loadingRecords: "Loading population — Please wait.", - lengthMenu: "Show _MENU_ populations", - info: "Showing _START_ to _END_ of _TOTAL_ populations" + loadingRecords: "Loading table data… Please wait.", + lengthMenu: "", + info: "" }, data: data, columns: columns, @@ -111,5 +118,15 @@ var buildDataTable = (tableId, data = [], columns = [], userSettings = {}) => { ...defaultSettings, ...userSettings }); + theDataTable.on("select", (event, datatable, type, cell, originalEvent) => { + datatable.rows({selected: true}).nodes().each((node, index) => { + $(node).find(".chk-row-select").prop("checked", true) + }); + }); + theDataTable.on("deselect", (event, datatable, type, cell, originalEvent) => { + datatable.rows({selected: false}).nodes().each((node, index) => { + $(node).find(".chk-row-select").prop("checked", false) + }); + }); return theDataTable; }; |