I have a problem in Livewire 2 when the modal close the page is disabled,
public function submit()
{
$this->validate();
$this->emit('success', __('New user created'));
$this->reset();
}
<div class="modal fade" id="kt_modal_add_user" tabindex="-1" aria-hidden="true" wire:ignore.self>
@push('js')
{{ $dataTable->scripts() }}
<script>
document.addEventListener('livewire:load', function () {
Livewire.on('success', function () {
console.log('test load');
$('#kt_modal_add_user').modal('hide');
window.LaravelDataTables['users-table'].ajax.reload();
});
});
</script>
@endpush
@alex
Hello,
We are going to need further information in order to help you.
Future tip: You can format your code using the toolbar or markdown syntax. I have made that change for you in your post above.
From your modal code, I think you're using a template from KeenThemes?
I think the page is not disabled, there's a modal-open
class added to the <body>
when you open a modal.
There's also a div
with a class of modal-backdrop
when the modal is open.
Give this a shot and let me know if it works.
<script>
document.addEventListener('livewire:load', function () {
Livewire.on('success', function () {
console.log('test load');
$('#kt_modal_add_user').modal('hide');
window.LaravelDataTables['users-table'].ajax.reload();
$('body').removeClass('modal-open'); // added
$('.modal-backdrop').remove(); // added
});
});
</script>