Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relation columns not displaying correctly #2682

Open
alextepes opened this issue Oct 29, 2024 · 0 comments · May be fixed by #2684
Open

Relation columns not displaying correctly #2682

alextepes opened this issue Oct 29, 2024 · 0 comments · May be fixed by #2684

Comments

@alextepes
Copy link

alextepes commented Oct 29, 2024

Description

When adding a A17\Twill\Services\Listings\Columns\Relation column to a listing, a string of commas and spaces is displayed instead of the display field.

Steps to reproduce

use A17\Twill\Services\Listings\Columns\Relation;
    public function getIndexTableColumns(): TableColumns
    {
        $tableColumns = TableColumns::make();

        $tableColumns->add(
            Text::make()
                ->title('Title')
                ->field('title')
                ->linkToEdit()
                ->sortable(),
        );
        $tableColumns->add(
            Relation::make()
                ->relation('category')
                ->title('Category')
                ->field('title')
                ->sortable()
        );
        return $tableColumns;
    }

In the model:

    public function category()
    {
        return $this->belongsTo(Category::class);
    }

Expected result

The title of the column should be displayed on the "Category" column.

Actual result

, , , , , , , , , , , , , is displayed on the "Category" column.
Screenshot 2024-10-29 at 12 00 22

Versions

Twill: 3.4.1
Laravel: 11.29
PHP 8.2.24
MariaDB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant