diff options
author | zsloan | 2022-07-27 18:29:51 +0000 |
---|---|---|
committer | zsloan | 2022-07-27 18:29:51 +0000 |
commit | d1616a5e0e225dbedddf423ac3ec74a99a66d5cc (patch) | |
tree | 1f913a97803738ef9bb4644161efa28e0ceb5731 /wqflask | |
parent | 7128050424f1e928a08011186c62d39c47e56bc0 (diff) | |
download | genenetwork2-d1616a5e0e225dbedddf423ac3ec74a99a66d5cc.tar.gz |
Allow create_table to handle tables without row data provided as JSON (so it can also convert regular HTML tables drawn in the template
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/static/new/javascript/create_datatable.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/wqflask/wqflask/static/new/javascript/create_datatable.js b/wqflask/wqflask/static/new/javascript/create_datatable.js index fc9530a5..2953655c 100644 --- a/wqflask/wqflask/static/new/javascript/create_datatable.js +++ b/wqflask/wqflask/static/new/javascript/create_datatable.js @@ -1,4 +1,4 @@ -create_table = function(tableId, tableData, columnDefs, customSettings) { +create_table = function(tableId, tableData = [], columnDefs = [], customSettings = {}) { loadDataTable(tableId=tableId, tableData=tableData, customSettings, firstRun=true) @@ -23,7 +23,6 @@ create_table = function(tableId, tableData, columnDefs, customSettings) { change_buttons() }); }, - "data": tableData, "columns": columnDefs, "sDom": "iti", "destroy": true, @@ -49,6 +48,10 @@ create_table = function(tableId, tableData, columnDefs, customSettings) { } } + if (tableData.length > 0){ + tableSettings["data"] = tableData + } + // Replace default settings with custom settings or add custom settings if not already set in default settings $.each(customSettings, function(key, value) { tableSettings[key] = value |