You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
On my User model I have the fields firstname and lastname.
The model has a getter attribute name to concatenate both :
public function getNameAttribute() {return implode(' ', array_filter([$this->firstname, $this->surname]));}
I can use this in the PowerGrid table like this :
->addColumn('name', function (User $user) {return $user->name;})
and
Column::make('name', 'name')->sortable()->searchable(),
Searching works fine. But sorting throws an arror because of course there's no field name in the database.
How can I modify the sortable() function to sort on more than 1 column?
Tip: I noticed there is a searchableRaw() function in the PowerGrid core.
Can the above problem be solved by adding an sortableRaw() function?
Thanks for any suggestion!
Beta Was this translation helpful? Give feedback.
All reactions