Skip to content

ERROR Call to a member function columns() on string using Custom head and body #35

Open
@twoarmtom

Description

@twoarmtom

Using the current method described in the documentation:

<x-splade-table :for="$users">
    <x-slot name="head">
        <thead>
            <tr>
                @foreach($users->columns() as $column)
                    <th>{{ $column->label }}</th>
                @endforeach
            </tr>
        </thead>
    </x-slot>
 
    <x-slot name="body">
        <tbody>
            @foreach($users->resource as $user)
                <tr>
                    ...
                </tr>
            @endforeach
        </tbody>
    </x-slot>
</x-splade-table>

If I use a dedicated class for the instance I get the error:

Call to a member function columns() on string

If I use an inline SpladeTable class it works, but then I lose export and bulk action features.

The purpose of the override is to create a mobile responsive table using the same instance, currently needing to load two instances to get this done.

Is there a different way to allow the dedicated class instance to work with this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions