2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00

Add missing callback for attachment delete button (#5219)

This commit is contained in:
Oliver 2023-07-11 10:29:33 +10:00 committed by GitHub
parent a9a8ac1c70
commit b3dcc28bd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -281,10 +281,20 @@ function loadAttachmentTable(url, options) {
sidePagination: 'server', sidePagination: 'server',
onPostBody: function() { onPostBody: function() {
// Add callback for 'delete' button
if (permissions.delete) {
$(table).find('.button-attachment-delete').click(function() {
let pk = $(this).attr('pk');
let attachments = $(table).bootstrapTable('getRowByUniqueId', pk);
deleteAttachments([attachments], url, options);
});
}
// Add callback for 'edit' button // Add callback for 'edit' button
if (permissions.change) { if (permissions.change) {
$(table).find('.button-attachment-edit').click(function() { $(table).find('.button-attachment-edit').click(function() {
var pk = $(this).attr('pk'); let pk = $(this).attr('pk');
constructForm(`${url}${pk}/`, { constructForm(`${url}${pk}/`, {
fields: { fields: {