Crud: orderBy doesn't work

Created on 25 Nov 2016  路  4Comments  路  Source: Laravel-Backpack/CRUD

Hi!

I'm trying to set a different order for my data list, I use $this->crud->orderBy('my_field') in the controller, but it doesn't works. It seems Datatable, on JS side which doesn't understand the ordering.

Most helpful comment

You're totally right, DataTable was ordering the table by its first column by default. That's now disabled, starting with CRUD 3.1.43.

Cheers!

All 4 comments

You're totally right, DataTable was ordering the table by its first column by default. That's now disabled, starting with CRUD 3.1.43.

Cheers!

@tabacitu I think this is still an issue, unless I am not understanding.

select * from `events` where `events`.`deleted_at` is null order by `starts_at` asc

is the query generated by

$this->crud->orderBy('starts_at');

But the table is still sorted by the first column.

If you started your project before CRUD 3.1.43 and have published the CRUD views (mainly list.blade.php) you might need to do that again.

That should fix it for you. Cheers!

Ah shoot, you're right. Sorry about that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikael1000 picture mikael1000  路  3Comments

packytagliaferro picture packytagliaferro  路  3Comments

deepaksp picture deepaksp  路  3Comments

sokvebolkol picture sokvebolkol  路  3Comments

M0H3N picture M0H3N  路  3Comments