Closed kidereo closed 9 months ago
default()
sets the default state of the column when there is no other content. Filament treats it as if it was real content. In this case, you're passing a string to default()
instead of an array, and since Filament treats it as real content, it breaks listWithLineBreaks()
since that expects an array.
placeholder()
is different, and allows you to pass in a string that is shown when there is no other content. It does not need to abide by the data type rules of the real content.
So either use placeholder('-')
, or default(['-'])
. The placeholder will be slightly lighter in color, whereas the default will look like actual content.
The fact this worked previously was a bug as default()
array content was not being output as it should have been. In the next release, I've fixed the exception so you can still use both methods together, but you shouldn't.
Perfect explanation, and indeed default(['-'])
works perfectly.
Many thanks for taking time to explain and for the Filament package in general!
Package
filament/filament
Package Version
v3.1.21
Laravel Version
v10.37.3
Livewire Version
v3.3.0
PHP Version
v8.2.11
Problem description
The
default()
andlistWithLineBreaks()
column methods no longer work together. They do work individually but produceUndefined variable $listLimit
error when both are used on the same column. They did work together prior to v3.1 update.Expected behavior
A column on which
listWithLineBreaks()
is used is expected to show the value of thedefault()
method if its state is empty.Steps to reproduce
Clone reproduction repository. Run migrations with seeder. Navigate to Books resource. Observe some books having authors on one line and some books having dashes (no authors). In the
BookResource
, uncommentlistWithLineBreaks()
and commentdefault('-')
. Observe some books having authors on multiple line and some books having nothing in the Authors column. In theBookResource
, uncommentdefault('-')
. ObserveUndefined variable $listLimit
error.Reproduction repository
https://github.com/kidereo/filamentphp-issues
Relevant log output
No response