filament-export icon indicating copy to clipboard operation
filament-export copied to clipboard

Method App\Filament\Resources\UserResource\Pages\ListUsers::getCachedTableColumns does not exist.

Open faizananwerali opened this issue 1 year ago • 8 comments

Method App\Filament\Resources\UserResource\Pages\ListUsers::getCachedTableColumns does not exist.

I tried to run this but got an error,

app/Filament/Resources/UserResource/Pages/ListUsers.php

class ListUsers extends ListRecords
{
    protected static string $resource = UserResource::class;

    public ?string $tableSortColumn = 'created_at';

    public ?string $tableSortDirection = 'desc';
    
    // ....
}

If I comment out public ?string $tableSortColumn = 'created_at'; this, then the application is working.

This is an error in vendor/alperenersoy/filament-export/src/Actions/Concerns/HasRecords.php

    protected function applySortingToTableQuery(Builder $query): Builder
    {
        /** @var \Filament\Resources\Pages\ListRecords $livewire */
        $livewire = $this->getLivewire();

        $columnName = $livewire->tableSortColumn;

        if (!$columnName) {
            return $query;
        }

        $direction = $livewire->tableSortDirection === 'desc' ? 'desc' : 'asc';

        if ($column = $livewire->getCachedTableColumns()[$columnName]) {
            $column->applySort($query, $direction);

            return $query;
        }

        if ($columnName === $livewire->getDefaultSortColumn()) {
            return $query->orderBy($columnName, $direction);
        }

        return $query;
    }

Laravel v10 Filament v3 Livewire v3

faizananwerali avatar Aug 22 '23 10:08 faizananwerali

Method App\Filament\Resources\UserResource\Pages\ListUsers::getCachedTableColumns does not exist.

I tried to run this but got an error,

app/Filament/Resources/UserResource/Pages/ListUsers.php

class ListUsers extends ListRecords
{
    protected static string $resource = UserResource::class;

    public ?string $tableSortColumn = 'created_at';

    public ?string $tableSortDirection = 'desc';
    
    // ....
}

If I comment out public ?string $tableSortColumn = 'created_at'; this, then the application is working.

This is an error in vendor/alperenersoy/filament-export/src/Actions/Concerns/HasRecords.php

    protected function applySortingToTableQuery(Builder $query): Builder
    {
        /** @var \Filament\Resources\Pages\ListRecords $livewire */
        $livewire = $this->getLivewire();

        $columnName = $livewire->tableSortColumn;

        if (!$columnName) {
            return $query;
        }

        $direction = $livewire->tableSortDirection === 'desc' ? 'desc' : 'asc';

        if ($column = $livewire->getCachedTableColumns()[$columnName]) {
            $column->applySort($query, $direction);

            return $query;
        }

        if ($columnName === $livewire->getDefaultSortColumn()) {
            return $query->orderBy($columnName, $direction);
        }

        return $query;
    }

Laravel v10 Filament v3 Livewire v3

How did you install this packages' version for filament 3?

lodekib avatar Sep 04 '23 14:09 lodekib

@lodekib add this in composer.json file.

"alperenersoy/filament-export": "^3.0@beta",

and then run composer update for filament v3.

faizananwerali avatar Sep 16 '23 17:09 faizananwerali

Hi, @faizananwerali , For me, doesn't work when export Table : League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, null given,

TranLTR avatar Nov 02 '23 16:11 TranLTR

I have the same issue on

Laravel 10 Filament 3 Livewire 3

Is this still an unsolved?

OccTherapist avatar Mar 19 '24 12:03 OccTherapist