aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2022-07-20 20:54:11 +0000
committerzsloan2022-07-20 20:54:11 +0000
commit36a7408d2c5cf3b8b7ebb2168fd34415e37184d0 (patch)
tree820908907e0929be9678bf2a0fd1fc0fdfd65d42 /wqflask
parentfb01efa96365cd649ac1a0892ac79bd371ddb405 (diff)
downloadgenenetwork2-36a7408d2c5cf3b8b7ebb2168fd34415e37184d0.tar.gz
Add drawCallback for highlighting selected rows to default tableSettings
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/static/new/javascript/create_datatable.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/wqflask/wqflask/static/new/javascript/create_datatable.js b/wqflask/wqflask/static/new/javascript/create_datatable.js
index 2a895e18..fc9530a5 100644
--- a/wqflask/wqflask/static/new/javascript/create_datatable.js
+++ b/wqflask/wqflask/static/new/javascript/create_datatable.js
@@ -9,8 +9,22 @@ create_table = function(tableId, tableData, columnDefs, customSettings) {
}
tableSettings = {
- 'data': tableData,
- 'columns': columnDefs,
+ "drawCallback": function( settings ) {
+ $('#' + tableId + ' tr').off().on("click", function(event) {
+ if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') {
+ var obj =$(this).find('input');
+ obj.prop('checked', !obj.is(':checked'));
+ }
+ if ($(this).hasClass("selected") && event.target.tagName.toLowerCase() !== 'a'){
+ $(this).removeClass("selected")
+ } else if (event.target.tagName.toLowerCase() !== 'a') {
+ $(this).addClass("selected")
+ }
+ change_buttons()
+ });
+ },
+ "data": tableData,
+ "columns": columnDefs,
"sDom": "iti",
"destroy": true,
"autoWidth": false,