rappasoft / laravel-livewire-tables

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

[Bug]: Undefined variables $columns - V3.3.3 => V3.4.8 #1866

Closed ZitelliDZ closed 2 months ago

ZitelliDZ commented 2 months ago

What happened?

Imagen de WhatsApp 2024-08-20 a las 12 11 17_0e7c31cd

How to reproduce the bug

The error occurs when the package is updated to the latest version. V3.3.3 => V3.4.8

Package Version

3.4.8

PHP Version

8.2.x

Laravel Version

11.17

Alpine Version

3.14.0

Theme

Bootstrap 5.x

Notes

No response

Error Message

No response

S-Marouene commented 2 months ago

i have the same problem when updating from V3.3.4 to V3.3.8 !

lrljoe commented 2 months ago

If you published the views, then this now uses computed properties to get rows/columns

lrljoe commented 2 months ago

I will issue an update for now to default to the original behaviour.

lrljoe commented 2 months ago

This should be fixed in the latest version. The new behaviour was set to enabled by default, this is no longer the case. Let me know if after updating this still presents an issue.

thomasgalue commented 2 months ago

This should be fixed in the latest version. The new behaviour was set to enabled by default, this is no longer the case. Let me know if after updating this still presents an issue.

In my case, only fails (for now) if there is a boolean column in the table.

Undefined variable $component Captura de pantalla_21-8-2024_205457_dot test I think you can see that pic. Some tables work, the ones that have booleandon't.

lrljoe commented 2 months ago

Replace with

@if ($isTailwind)
    @if ($status)
        @if ($type === 'icons')
            @if ($successValue === true)
                <x-heroicon-o-check-circle class="inline-block h-5 w-5 text-green-500" />
            @else
                <x-heroicon-o-check-circle class="inline-block h-5 w-5 text-red-500" />
            @endif
        @elseif ($type === 'yes-no')
            @if ($successValue === true)
                <span>Yes</span>
            @else
                <span>No</span>
            @endif
        @endif
    @else
        @if ($type === 'icons')
            @if ($successValue === false)
                <x-heroicon-o-x-circle class="inline-block h-5 w-5 text-green-500" />
            @else
                <x-heroicon-o-x-circle class="inline-block h-5 w-5 text-red-500" />
            @endif
        @elseif ($type === 'yes-no')
            @if ($successValue === false)
                <span>Yes</span>
            @else
                <span>No</span>
            @endif
        @endif
    @endif
@elseif ($isBootstrap)
    @if ($status)
        @if ($type === 'icons')
            @if ($successValue === true)
                <x-heroicon-o-check-circle  class="d-inline-block text-success laravel-livewire-tables-btn-small" />
            @else
                <x-heroicon-o-check-circle class="d-inline-block text-danger laravel-livewire-tables-btn-small" />
            @endif
        @elseif ($type === 'yes-no')
            @if ($successValue === true)
                <span>Yes</span>
            @else
                <span>No</span>
            @endif
        @endif
    @else
        @if ($type === 'icons')
            @if ($successValue === false)
                <x-heroicon-o-x-circle class="d-inline-block text-success laravel-livewire-tables-btn-small" />
            @else
                <x-heroicon-o-x-circle class="d-inline-block text-danger laravel-livewire-tables-btn-small" />
            @endif
        @elseif ($type === 'yes-no')
            @if ($successValue === false)
                <span>Yes</span>
            @else
                <span>No</span>
            @endif
        @endif
    @endif
@endif

There have been numerous changes to the blades/views, so would recommend that you look at migrating to the new ones.

thomasgalue commented 2 months ago

My bad I think, should a clean install works or how can I migrate to the new blade/views?

lrljoe commented 2 months ago

If you've not changed anything in the views manually, then you can just delete the resources/views/vendor/livewire-tables directory. You don't need to publish the views for anything to work.

Alternatively - rename the directory temporarily to give it a test!

lrljoe commented 2 months ago

If you have previously published the views, you will need to set the following in your configure method:

    public function configure(): void
    {
        $this->useComputedPropertiesDisabled();
    }

This ensures that the original methodology is used.