SHOW:
|
|
- or go back to the newest paste.
1 | <td class="table-icon text-center"> | |
2 | - | <a class="btn btn-sm btn-delete"> |
2 | + | <a class="btn btn-sm btn-delete" onclick="deleteRow(ctrl); return false;"> |
3 | <span class="icon icon-bin" aria-hidden="true"></span> | |
4 | </a> | |
5 | </td> | |
6 | ||
7 | ||
8 | ||
9 | ||
10 | ||
11 | var tmprow = null; | |
12 | - | $('.btn-delete').on('click', function(e) { |
12 | + | function deleteRow(ctrl) { |
13 | - | bootbox.confirm({ |
13 | + | tmprow = $(ctrl).closest('tr'); |
14 | bootbox.confirm({ | |
15 | message: "Are you sure you want to delete this objective?", | |
16 | buttons: { | |
17 | confirm: { | |
18 | label: 'Delete', | |
19 | className: 'btn-danger' | |
20 | }, | |
21 | cancel: { | |
22 | label: 'Cancel', | |
23 | className: 'btn-default' | |
24 | } | |
25 | }, | |
26 | - | console.log('This was logged in the callback: ' + result + this); |
26 | + | |
27 | if (result == true) { | |
28 | $(tmprow).remove(); | |
29 | } | |
30 | - | }); |
30 | + | tmprow = null; |
31 | } | |
32 | }); | |
33 | } |