diff --git a/app/Http/Controllers/TableController.php b/app/Http/Controllers/TableController.php index 2007278..f809763 100644 --- a/app/Http/Controllers/TableController.php +++ b/app/Http/Controllers/TableController.php @@ -45,7 +45,9 @@ class TableController extends Controller $columns = Column::columnsFromJson($revision->columns); - $rows = $revision->rowsData($columns)->paginate(25, []); + $rq = $revision->rowsData($columns); + if (count($columns)) $rq = $rq->orderByRaw("data->>'".$columns[0]->id."'"); + $rows = $rq->paginate(25, []); return view('table.view', [ 'table' => $tableModel,