diff options
-rw-r--r-- | wqflask/wqflask/static/new/javascript/create_datatable.js | 18 |
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, |