Fix loading of non-repository tables on item cards changes [SCI-9970]

This commit is contained in:
Andrej 2024-01-09 16:53:46 +01:00
parent a6c0c7294b
commit c73bc0bed1
9 changed files with 12 additions and 12 deletions

View file

@ -93,7 +93,7 @@
updateCallback = (data) => {
if (!data?.value) return;
// reload dataTable
if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false);
if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false);
// update item card stock column
window.manageStockCallback && window.manageStockCallback(data.value);
$link.data('manageStockUrl', data.value.stock_url)

View file

@ -270,7 +270,7 @@ export default {
},
success: (result) => {
$this.addRelationCallback(result, relation);
if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false);
if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false);
}
});
this.close();

View file

@ -544,7 +544,7 @@ export default {
}).done((response) => {
if (response) {
this.customColumns = this.customColumns.map((col) => (col.id === response.id ? { ...col, ...response } : col));
if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false);
if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false);
}
});
},
@ -560,7 +560,7 @@ export default {
async unlinkItem() {
await axios.delete(this.selectedToUnlink.unlink_path);
this.loadRepositoryRow(this.currentItemUrl);
if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false);
if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false);
this.selectedToUnlink = null;
}
}

View file

@ -74,7 +74,7 @@ export default {
break;
}
Object.assign($this.$data, { isEditing: false, isSaving: false, values: result?.value });
if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false);
if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false);
}
});
},

View file

@ -166,7 +166,7 @@ export default {
} else {
this.file_name = '';
}
if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false);
if ($('.dataTable.repository-dataTable')[0]) $('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false);
},
error: () => {
this.error = I18n.t('repositories.item_card.repository_asset_value.errors.upload_failed_general');

View file

@ -186,10 +186,10 @@ export default {
success: () => {
this.defaultStartDate = this.startDate;
this.defaultEndDate = this.endDate;
if ($('.dataTable')[0]) {
$('.dataTable').DataTable().ajax.reload(null, false);
this.reloadRepoItemSidebar();
if ($('.dataTable.repository-dataTable')[0]) {
$('.dataTable.repository-dataTable').DataTable().ajax.reload(null, false);
}
this.reloadRepoItemSidebar();
}
});
},

View file

@ -1,4 +1,4 @@
<table class="table"
<table class="table repository-dataTable"
data-id="<%= @repository.id %>"
data-type="live"
data-source="<%= index_dt_my_module_repository_path(@my_module, @repository) %>"

View file

@ -27,7 +27,7 @@
data-footer-label="<%= assigned_repository_simple_view_footer_label(repository) %>"
data-name-column-id="<%= assigned_repository_simple_view_name_column_id(repository) %>"
>
<table class="table hidden repository-table"
<table class="table hidden repository-table repository-dataTable"
data-stock-management="<%= repository.has_stock_management? %>"
data-stock-consumption-editable="<%= can_update_my_module_stock_consumption?(@my_module) %>">
<thead>

View file

@ -1,6 +1,6 @@
<div class="repository-table">
<div class="repository-table-error"></div>
<table id="repository-table-<%= repository.id %>" class="table table--reorderable-columns"
<table id="repository-table-<%= repository.id %>" class="table table--reorderable-columns repository-dataTable"
data-current-uri="<%= request.original_url %>"
data-repository-id="<%= repository.id %>"
data-source="<%= repository_index_link %>"