-
Thanks beforehandbeforehand i really like using your library 👍 , i would like to ask on how to order and sort an added column, and the column is not inside database. // user model public function status(){ return Cache::has('is_online'.$this->id) ? 'online' : 'offline'; } and in my datatables service this is how i add the column public function dataTable($query) { return datatables() ->eloquent($query) ->addColumn('status', function($user) { $status = $user->status(); // online or offline $text = ucwords($status); return "<div class=\"online-indicator strtolower($status)\"><span class=\"blink $status\"></span></div> $text"; }) ->rawColumns(['status']) ->orderColumn('status', function ($query, $order) { // still no luck here $query->orderBy('status', $order); }); // ->order(function ($query){ <-- i tried this // if(request()->has('status')){ // $query->orderBy('status'); // } // }); } i have managed to show the data, but the error comes when i try sorting / ordering it. do i really have to store it in database to make it work or is it possible? edit : i have found out that addcolumn cant be sorted or ordered, ill be trying again |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
#1790 (comment) and #2663 (comment) said its kinda impossible. |
Beta Was this translation helpful? Give feedback.
#1790 (comment) and #2663 (comment) said its kinda impossible.