rappasoft / laravel-livewire-tables

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

[Bug]: collapsing seems to be broken on table row because of the breakpoints that doesnt match with the one on table head #1646

Closed mrevanzak closed 7 months ago

mrevanzak commented 8 months ago

What happened?

so this happens to me

image

the last 2 columns should be on collapse but the table row doesn't disappear, only the table head disappears. the culprit is lg:table-cell on the table head but md:table-cell on the table row

How to reproduce the bug

just use collapseOnTablet() or collapseOnMobile

Package Version

3.2.0

PHP Version

8.1.x

Laravel Version

10

Alpine Version

No response

Theme

Tailwind 3.x

Notes

No response

Error Message

No response

lrljoe commented 8 months ago

Apologies for the delay, will try to get this one resolved this weekend! It didn't come up during testing oddly, so need to check if I've got something custom on my end.

lrljoe commented 7 months ago

Okay, identified the issue, will have a fix in this weekend's release!

Astalyos commented 7 months ago

image_2024-02-22_154034442 Hi Joe ! I just installed the package today and might have something that seems connected to that too Let me know if you need more details

I don't have anything special in the code tho, i've joined the discord so i'll be checking the releases patches from there !

Package Version 3.2 Php : 8.2 Laravel 10

Have a good one !

class LocationCountry extends DataTableComponent
{
    protected $model = Country::class;

    public function configure(): void
    {
        $this->setPrimaryKey('id');
        $this->setAdditionalSelects(['call_prefix']);
        $this->setComponentWrapperAttributes([
            'class' => '',
        ]);
        $this->setDebugEnabled();
        $this->setSearchEnabled();
        $this->setSortingEnabled();
    }

    public function columns(): array
    {
        return [
            Column::make('Id', 'id')
                ->sortable(),
            Column::make('Name')->label(fn ($row) => $row->name)
                ->sortable(fn (Builder $query, $direction) => $query->orderBy('name', $direction))
                ->searchable(fn (Builder $query, $term) => $query->where('name', 'like', '%'.$term.'%')),
            Column::make('Iso code', 'iso_code')
                ->sortable(),
            Column::make('Prefix')->label(fn ($row) => '+'.$row->call_prefix)
                ->sortable(),
            Column::make('Zone', 'zone.name')
                ->eagerLoadRelations()
                ->sortable(),
            BooleanColumn::make('Enabled', 'active')
                ->sortable(),
        ];
    }
}

My inject core assets was set to false in my config file, setting it to true fixed it !

/**
 * Enable or Disable automatic injection of core assets
 */
'inject_core_assets_enabled' => true,
lrljoe commented 7 months ago

Currently testing the fix https://github.com/rappasoft/laravel-livewire-tables/pull/1665

lrljoe commented 7 months ago

Released in 3.2.1