Why is the DataTable turns to normal table when clicking/calling another function?
Why is the DataTable turns to normal table when clicking/calling another function?
Anonymouse703
Posts: 18Questions: 8Answers: 0
in General
I used Bootstrap DataTable in my Laravel-Livewire project. I noticed that when I click another function (Add, Edit, Delete, Store, Open a modal and etc.) the DataTable turns into a normal table.
This is how I implemented it in my script.
<script>
$(document).ready(function() {
$('#clientTypeTable').DataTable();
} );
window.livewire.on('closeClientTypeModal', () => {
$('#clientTypeModal').modal('hide');
});
window.livewire.on('openClientTypeModal', () => {
$('#clientTypeModal').modal('show');
});
window.addEventListener('swal:confirmClientTypeDelete', event => {
swal.fire({
title: event.detail.title,
text: event.detail.text,
icon: event.detail.icon,
showCancelButton: event.detail.showCancelButton,
confirmButtonColor: event.detail.confirmButtonColor,
cancelButtonColor: event.detail.cancelButtonColor,
confirmButtonText: event.detail.confirmButtonText,
}).then((result) => {
if (result.isConfirmed) {
window.livewire.emit('deleteClientType',event.detail.id)
swal.fire(
'Deleted!',
'Your file has been deleted.',
'success'
)
}
});
});
//
</script>
Answers
Do you get errors in the browser's console?
In order to help debug we will need to see the problem happen. Please post a link to your page or a test case replicating the issue.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
I make a starter kit using Laravel+Livewire and implemented a Bootstrap DataTable you can see the code and the structure.
https://github.com/anonymouse703/livewire-starter-kits
If you want to be a collaborator I can add you in the repo.
I make a starter kit using Laravel+Livewire and implemented a Bootstrap DataTable you can see the code and the structure.
https://github.com/anonymouse703/livewire-starter-kits
If you want to be a collaborator I can add you in the repo.
Please re-read Kevin's post.
@tangerine I tried to see some sample but doesn't work... I will try to look on some samples.
@kthorngren send me your username to batangkritiko703@gmail.com
@tangerine maybe you want to look the code an be a collaborator
To progress this, please make it easy for us, linking to your page or creating a test case that demonstrates the issues allows us to help you. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
If you don't want to provide the link to your page here you can send Colin or Allan, the developers, a PM with access details. Use the
Ask a Private Question
button.Kevin
did you resolve your issue?. I am facing the same issue please help me