|
|
@@ -1064,6 +1064,12 @@
|
|
|
|
|
|
importModal.addEventListener('hidden.bs.modal', function () {
|
|
|
importModalOpen = false;
|
|
|
+ // Ensure table is reloaded when modal is closed
|
|
|
+ setTimeout(() => {
|
|
|
+ if (!$.fn.DataTable.isDataTable('#tablesaw-350')) {
|
|
|
+ loadDataTable();
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
});
|
|
|
|
|
|
document.addEventListener('livewire:update', function() {
|
|
|
@@ -1075,6 +1081,13 @@
|
|
|
} else if (!importModal.classList.contains('show')) {
|
|
|
modalInstance.show();
|
|
|
}
|
|
|
+
|
|
|
+ // Re-initialize table if needed after Livewire updates
|
|
|
+ setTimeout(() => {
|
|
|
+ if (!$.fn.DataTable.isDataTable('#tablesaw-350')) {
|
|
|
+ loadDataTable();
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -1102,11 +1115,24 @@
|
|
|
}
|
|
|
|
|
|
function openImportModal() {
|
|
|
+ let tableState = null;
|
|
|
+ if ($.fn.DataTable.isDataTable('#tablesaw-350')) {
|
|
|
+ tableState = $('#tablesaw-350').DataTable().state.save();
|
|
|
+ }
|
|
|
+
|
|
|
const importModal = new bootstrap.Modal(document.getElementById('importModal'));
|
|
|
importModal.show();
|
|
|
|
|
|
setTimeout(function() {
|
|
|
initImportCausalSelect();
|
|
|
+
|
|
|
+ // Ensure the table is reloaded when modal is shown
|
|
|
+ if (!$.fn.DataTable.isDataTable('#tablesaw-350')) {
|
|
|
+ loadDataTable();
|
|
|
+ if (tableState) {
|
|
|
+ $('#tablesaw-350').DataTable().state.load(tableState);
|
|
|
+ }
|
|
|
+ }
|
|
|
}, 200);
|
|
|
}
|
|
|
|
|
|
@@ -1126,13 +1152,15 @@
|
|
|
|
|
|
function closeImportModal() {
|
|
|
const importModal = bootstrap.Modal.getInstance(document.getElementById('importModal'));
|
|
|
- console.log("closing");
|
|
|
if (importModal) {
|
|
|
importModal.hide();
|
|
|
}
|
|
|
+
|
|
|
setTimeout(function() {
|
|
|
- window.location.reload();
|
|
|
- }, 400);
|
|
|
+ if (!$.fn.DataTable.isDataTable('#tablesaw-350')) {
|
|
|
+ loadDataTable();
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
}
|
|
|
|
|
|
Livewire.on('update-progress', (progress) => {
|
|
|
@@ -1249,7 +1277,7 @@
|
|
|
// Reload the page to refresh the data
|
|
|
setTimeout(function() {
|
|
|
window.location.reload();
|
|
|
- }, 5000);
|
|
|
+ }, 1500);
|
|
|
});
|
|
|
|
|
|
|