How to searchable and sortable my custom column?

Help me, How to searchable and sortable my custom column? here is my code:
TextColumn::make('description')
->getStateUsing(function ($record) {
return $record->brand->name . ' ' . $record->model->name . ' ' . $record->type->name . ' ' . $record->kind->name . ' (' . $record->series->name . ') ' . number_format(doubleval($record->cylinder->volume / 1000), 1) . ' ' . $record->transmission->name . ' ' . $record->gear->name . ' ' . $record->fuel->name . ' ' . $record->color->name . ' (' . $record->year->name . ') ' . $record->row->name;
})
->wrap(),
TextColumn::make('description')
->getStateUsing(function ($record) {
return $record->brand->name . ' ' . $record->model->name . ' ' . $record->type->name . ' ' . $record->kind->name . ' (' . $record->series->name . ') ' . number_format(doubleval($record->cylinder->volume / 1000), 1) . ' ' . $record->transmission->name . ' ' . $record->gear->name . ' ' . $record->fuel->name . ' ' . $record->color->name . ' (' . $record->year->name . ') ' . $record->row->name;
})
->wrap(),
thanks
Solution:
I don’t know. Sorry. You probably need to append it to another column instead
Jump to solution
3 Replies
Dennis Koch
Dennis Koch13mo ago
You can’t unless you store that calculation in the DB.
wandiaprianto
wandiapriantoOP13mo ago
thankyou Sir. i have another question Sir, How to set TextColumn isHidden / Disabled but searchable? this is my code:
TextColumn::make('brand.name')
->searchable()
->sortable()
->hidden(),
TextColumn::make('brand.name')
->searchable()
->sortable()
->hidden(),
is hide, but i can't search. where did i missed? thankyou
Solution
Dennis Koch
Dennis Koch13mo ago
I don’t know. Sorry. You probably need to append it to another column instead
Want results from more Discord servers?
Add your server