F
Filament15mo ago
pratik

How to render json column data in table TextColumn

I have call_email json field that holds the data inserted using repeater and array casted in the model :
[{"email": "[email protected]", "phone": "+8798998786xx"}] How to show this data in TextColumn ?
6 Replies
Vp
Vp15mo ago
using TextColumn.. is there any error?
shad
shad15mo ago
did you find a solution? cuz I have the same problem 😓
pratik
pratikOP14mo ago
@Vp @shad I want to show the email from call_email field. If I use
TextColumn::make('call_email.email')
TextColumn::make('call_email.email')
it shows nothing in the table.
No description
No description
No description
No description
No description
Vp
Vp14mo ago
It seems like we cannot display repeater data with key:value in a table. but only value json data (below) is displayed correctly
// It displayed correctly using TextColumn
["[email protected]", "+87 98998xxxx"]

// this throw error
[{"email": "[email protected]", "phone": "+8798998786xx"}]
// It displayed correctly using TextColumn
["[email protected]", "+87 98998xxxx"]

// this throw error
[{"email": "[email protected]", "phone": "+8798998786xx"}]
@Dennis Koch sorry for tagging here but do you have any solution here.. Objective is to display repeater json data in a table column
Dennis Koch
Dennis Koch14mo ago
Your db column contains an array of objects. So it would be call_email.0.email to show the first one.
pratik
pratikOP14mo ago
Thank you so much @Dennis Koch @Vp

Did you find this page helpful?