Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for relations ordering #1782

Open
wants to merge 2 commits into
base: 8.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "yajra/laravel-datatables-oracle",
"name": "vladrub/laravel-datatables-oracle",
Copy link
Owner

@yajra yajra Jun 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but changing the name will break the package. Please revert this one.

"description": "jQuery DataTables API for Laravel 4|5",
"keywords": [
"laravel",
Expand Down
5 changes: 5 additions & 0 deletions src/QueryDataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,11 @@ protected function defaultOrdering()
})
->each(function ($orderable) {
$column = $this->resolveRelationColumn($orderable['name']);

$parts = explode('.', $column);
if ( count($parts) == 1 ) {
$column = $this->query->getModel()->getTable() . '.' . $column;
}

if ($this->hasOrderColumn($column)) {
$this->applyOrderColumn($column, $orderable);
Expand Down