Hide textColumn based of the value of another column

Is possible to do this?
15 Replies
Dennis Koch
Dennis Koch2y ago
Yes. Search the docs for "Dependant fields" Okay, you are close.
Yeraldi29#2900
Yeraldi29#2900OP2y ago
Thanks but the thing is that this does not accept reactive
Dennis Koch
Dennis Koch2y ago
Make the "screen" field ->reactive And use $get. $record does not update
->hidden(function ($get) {
$screen = $get('screen');
->hidden(function ($get) {
$screen = $get('screen');
Yeraldi29#2900
Yeraldi29#2900OP2y ago
It gives me this error Method Filament\Tables\Columns\TextColumn::reactive does not exist. This is because is displaying information in a table and is not a form, I think
Dennis Koch
Dennis Koch2y ago
Oh sorry. I didn't see that this is about tables.
Yeraldi29#2900
Yeraldi29#2900OP2y ago
Don't worry
Dennis Koch
Dennis Koch2y ago
Then: It doesn't make sense to hide columns based on the record. It would break the table layout if rows had different number of columns
Yeraldi29#2900
Yeraldi29#2900OP2y ago
Oh I understand, thank you so much, I was trying something with a custom accessor and that column comes from the accessor but then I need to search another way to do this
Dennis Koch
Dennis Koch2y ago
How it hiding columns related to an accessor? Maybe explain your original problem?
Patrick Boivin
Do you want to show a blank column instead, if the record has a certain state?
Yeraldi29#2900
Yeraldi29#2900OP2y ago
Ok the thing is that I have this custom accessor, this will show me a number that must be showed if the value of this column TextColumn::make('screen') ->label('Tipo de pantalla') ->sortable(), is equal to "something" if not I want to hide this TextColumn::make('number_dealer_profile') ->label('Perfil')
Yeraldi29#2900
Yeraldi29#2900OP2y ago
Well That was my idea
Dennis Koch
Dennis Koch2y ago
Use ->formatStateUsing then
Yeraldi29#2900
Yeraldi29#2900OP2y ago
Thank you
Dennis Koch
Dennis Koch2y ago
And return an empty string if you want to hide the content
Want results from more Discord servers?
Add your server