[Bug] Disable default order by model key
See original GitHub issueBug report
What I did
reading the list operation code
What I expected to happen
code should be correct
What happened
it seem variable not capture as reference
What I’ve already tried to fix it
nothing
Backpack, Laravel, PHP, DB version
not sure
in this file:https://github.com/Laravel-Backpack/CRUD/blob/master/src/app/Http/Controllers/Operations/ListOperation.php in search function:
collect($orderBy)->each(function ($item, $key) use ($hasOrderByPrimaryKey) {
if (! isset($item['column'])) {
return false;
}
if ($item['column'] == $this->crud->model->getKeyName()) {
$hasOrderByPrimaryKey = true;
return false;
}
});
i think variable $hasOrderByPrimaryKey
should pass as reference &$hasOrderByPrimaryKey
to work at $hasOrderByPrimaryKey = true;
command.
Btw, is there anyway to disable order by?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Is there a way to disable initial sorting for jquery DataTables?
This answer was a great help but it's worth noting the potential confusion caused. If col 0 is pre-sorted asc and this initial...
Read more >DataGrid - How to disable default sorting by key
Hello, I have a problem with DataGrid embedded in DropDownBox. Source of grid is list populated by SQL query which is sorted by...
Read more >CAP NodeJS remove implicit sorting on primary key
We are facing an issue where every service defined in CAP (Nodejs module) returns the result set in sorted order of primary key...
Read more >Ability to change default sort option on the Issues page - Jira
Currently the default sort option in the Issues view is set to Order by Priority. This default cannot be changed. For projects where...
Read more >Disable Default Sorting - Ask TOM - Oracle
There is no such THING as a "default sort". The data is *not* coming out in the order of insertion. That is a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@promatik i think it works now. Thanks.
@phammanh029 regarding your question (disable default order by ID) that PR doesn’t solve it.
Can you please give us an example why you’d want to remove the default ordering by model primary key? I’m finding it difficult to see a situation where it could be useful.
Anyway, if there are use cases, we may add an operation setting for that.
Please let me know 🙌