mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-14 01:02:59 -07:00
Fix delete history row only if the button is clicked
History row was deleting even when clicking in the table cell outside the button.
This commit is contained in:
parent
5168d76e86
commit
fcbc921470
1 changed files with 13 additions and 13 deletions
|
@ -28,6 +28,16 @@ history_table_options = {
|
||||||
"order": [ 1, 'desc'],
|
"order": [ 1, 'desc'],
|
||||||
"autoWidth": false,
|
"autoWidth": false,
|
||||||
"columnDefs": [
|
"columnDefs": [
|
||||||
|
{
|
||||||
|
"targets": [0],
|
||||||
|
"data": null,
|
||||||
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
|
$(td).html('<button class="btn btn-xs btn-danger" data-id="' + rowData['id'] + '"><i class="fa fa-trash-o"></i> Delete</button>');
|
||||||
|
},
|
||||||
|
"className": "delete-control no-wrap hidden",
|
||||||
|
"searchable": false,
|
||||||
|
"orderable": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"targets": [1],
|
"targets": [1],
|
||||||
"data":"date",
|
"data":"date",
|
||||||
|
@ -175,16 +185,6 @@ history_table_options = {
|
||||||
"className": "no-wrap hidden-md hidden-sm hidden-xs",
|
"className": "no-wrap hidden-md hidden-sm hidden-xs",
|
||||||
"width": "10px"
|
"width": "10px"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"targets": [0],
|
|
||||||
"data": null,
|
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
|
||||||
$(td).html('<button class="btn btn-xs btn-danger" data-id="' + rowData['id'] + '"><i class="fa fa-trash-o"></i> Delete</button>');
|
|
||||||
},
|
|
||||||
"className": "delete-control no-wrap hidden",
|
|
||||||
"searchable": false,
|
|
||||||
"orderable": false
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
"drawCallback": function (settings) {
|
"drawCallback": function (settings) {
|
||||||
// Jump to top of page
|
// Jump to top of page
|
||||||
|
@ -247,13 +247,13 @@ $('#history_table').on('click', 'td.modal-control-ip', function () {
|
||||||
getUserLocation(rowData['ip_address']);
|
getUserLocation(rowData['ip_address']);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#history_table').on('click', 'td.delete-control', function () {
|
$('#history_table').on('click', 'td.delete-control > button', function () {
|
||||||
var tr = $(this).parents('tr');
|
var tr = $(this).parents('tr');
|
||||||
var row = history_table.row( tr );
|
var row = history_table.row( tr );
|
||||||
var rowData = row.data();
|
var rowData = row.data();
|
||||||
|
|
||||||
$(this).children("button").prop('disabled', true);
|
$(this).prop('disabled', true);
|
||||||
$(this).children("button").html('<i class="fa fa-spin fa-refresh"></i> Delete');
|
$(this).html('<i class="fa fa-spin fa-refresh"></i> Delete');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'delete_history_rows',
|
url: 'delete_history_rows',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue