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

withColumns TextColumn Enum not supported

Open NoahNxT opened this issue 1 year ago • 1 comments

When I add an extra TextColumn via the withColums method with the method enum on it crashes the export and returns an error.

 ->withColumns([
                    TextColumn::make('gender')
                    ->label(__('fields.member.fields.gender.label'))
                    ->enum(GenderEnum::casesWithLabels())
                ])

GenderEnum function

public static function casesWithLabels(): array
    {
        $labels = [];
        foreach (self::cases() as $case) {
            $labels[$case->value] = __('genders.' . $case->value);
        }

        return $labels;
    }

Error message in console

Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
    value index.js:75
    promise callback*value/< index.js:70
    promise callback*value index.js:68
    sendMessage index.js:242
    value index.js:252
    later debounce.js:8
    setTimeout handler*debounce/< debounce.js:12
    value index.js:225
    debouncedHandler node_initializer.js:243
    value index.js:582
    debouncedHandler node_initializer.js:201
    attachListener node_initializer.js:259
    attachDomListener node_initializer.js:181
    initialize node_initializer.js:42
    initialize node_initializer.js:15
    value index.js:92
    value index.js:525
    walk walk.js:5
    walk walk.js:10
    walk walk.js:10
    walk walk.js:10
    value index.js:511
    value index.js:90
    Component index.js:51
    value index.js:88
    value index.js:87
    <anonymous> Ember
    gt app.js:1
    start app.js:1
    888 app.js:90
    i app.js:90
    <anonymous> app.js:90
    O app.js:90
    <anonymous> app.js:90
    <anonymous> app.js:90
index.js:75:57

NoahNxT avatar May 11 '23 23:05 NoahNxT

@NoahNxT hey! as I see now there is no problem with that. can you try the latest version and check if it is solved?

alperenersoy avatar Jun 01 '23 19:06 alperenersoy