rappasoft / laravel-livewire-tables

A dynamic table component for Laravel Livewire
https://rappasoft.com/docs/laravel-livewire-tables/v2/introduction
MIT License
1.7k stars 320 forks source link

[Bug]: Loading placeholder not working #1625

Closed StuBlackett2022 closed 4 months ago

StuBlackett2022 commented 6 months ago

What happened?

Hello,

I've added

$this->setLoadingPlaceholderBlade('livewire/loaders/table-loader');

To my table, which loads the following HTML

<div class="bg-white text-center p-5">
    <i class="fa fa-tire fa-2xl fa-spin"></i>
</div>

The loader shows in the table (In the wrong place) and also doesn't dissapear once the table has been rendered.

Screenshot 2024-01-02 at 14 58 45

I've followed the docs and tried various things, but no luck

How to reproduce the bug

Add a loader as per the docs : https://rappasoft.com/docs/laravel-livewire-tables/v3/datatable/loaders#content-loading-placeholder

$this->setLoadingPlaceholderBlade('livewire/loaders/table-loader');

Package Version

3.1.8

PHP Version

8.3.x

Laravel Version

10.38.1

Alpine Version

No response

Theme

Bootstrap 5.x

Notes

No response

Error Message

No response

lrljoe commented 5 months ago

Thanks for the bug report, I've managed to replicate the issue.

To avoid the need to add more customisation classes for the loader, at present it expects to be wrapped in <tr><td>**YOUR CONTENT HERE**</td></tr>

e.g, your table-loader becomes

<tr>
    <td colspan="{{ $colCount }}">
        <div class="bg-white text-center p-5">
            <i class="fa fa-tire fa-2xl fa-spin"></i>
        </div>
    </td>
</tr>

I suspect that what we'll end up with is:

Option 1 - Define plain-text content to display in the loading table row using setLoadingPlaceholderContent() Option 2 - Replace content of the loading table row using setLoadingPlaceHolderContentBlade() Option 3 - Replace the loading table row using setLoadingPlaceHolderBlade()

But I can't say for sure (as I just don't know myself yet!)

I'm normally on the official Discord pretty regularly, so feel free to reach out on there if the above doesn't make sense, or if you have some other ideas!

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.