Closed Varin6 closed 1 year ago
You can try using filterColumn and orderColumn api and manually write its custom query handler.
In cases like this, I usually start writing an equivalent query for it the convert it to laravel code.
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been inactive for 7 days since being marked as stale.
I'm using Laravel 5.6 and yajira datatables plugin.
I want to display user status in one of the columns which is a number from 0-5 in the database but I want to show and display it in the column as words, (New, Updated, Initial, etc.)
Method to make the datatable:
As you can see, the
status
is returned as$user->status_name
which is an Accessor method on my User Model:And the UserStatus Enum class has the logic for the status translation from digits to strings:
In the view, I fetch the data via jQuery Ajax and datatables my code in the view is here:
Now, because of
name:user.status
the search and ordering will be based on theuser.status
column which is just digits. Is there a way to force it to use displayed data for search and ordering? Please point me in the right direction. The only thing that works is switching ServerSide off.