Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

zikrimuhammad09's avatar

Issue with Preline DataTables and Livewire: Table Disappears When Data Is Updated Without wire:ignore

I’m working with Livewire and Preline DataTables in a Laravel project. I have a table that uses Preline DataTables to display data dynamically managed by Livewire. When I add new data (without using wire:ignore), the table data updates successfully, but the DataTable functionality (like sorting and pagination) disappears.

If I add wire:ignore to the table, the DataTable functionality works, but the table data doesn't update when new data is added.

Has anyone encountered a similar issue or found a solution?

Thanks in advance!

pagination blade component:

<div class="hidden px-4 py-1 mt-2" data-hs-datatable-paging="">
    <nav class="flex items-center justify-center space-x-1">
        <button type="button"
            class="inline-flex items-center justify-center text-sm border rounded-lg size-9 border-base-200/2 hover:bg-secondary-parsinta/90 gap-x-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none"
            data-hs-datatable-paging-prev="">
            <span aria-hidden="true">
                <x-heroicon-o-chevron-left class="size-4" />
            </span>
            <span class="sr-only">Previous</span>
        </button>
        <div class="flex items-center space-x-1 [&>.active]:bg-green-dark2 [&>.active]:text-dark"
            data-hs-datatable-paging-pages=""></div>
        <button type="button"
            class="inline-flex items-center justify-center text-sm border rounded-lg size-9 border-base-200/2 hover:bg-secondary-parsinta/90 gap-x-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none"
            data-hs-datatable-paging-next="">
            <span class="sr-only">Next</span>
            <span aria-hidden="true">
                <x-heroicon-o-chevron-right class="size-4" />
            </span>
        </button>
    </nav>
</div>
0 likes
1 reply
zikrimuhammad09's avatar

I've done this, but it doesn't work either

@script
    <script>
        HSTooltip.autoInit();
        $wire.on('closeModal', function() {
            const datatable = document.querySelector('#hs-datatable-faktur-barang');
            const {
                element
            } = HSDataTable.getInstance(datatable, true);

            element.destroy();

            HSDataTable.autoInit();
        });
    </script>
@endscript

Please or to participate in this conversation.