Crud: Order by not working with enableDetailsRow

Created on 19 Apr 2017  路  15Comments  路  Source: Laravel-Backpack/CRUD

When i put
$this->crud->enableDetailsRow();
in my controller the order by (click on the columns titles) on the list is not working anymore.

Most helpful comment

@MarcosBL thanks for reopening it earlier!

All 15 comments

Maybe fixed in https://github.com/Laravel-Backpack/CRUD/pull/619 if you want to give it a try, as it defines the column with the "+" sign as non sortable, and the problem seems to be Datatables ordering the wrong column due to a off by one error

@adbmdp - do you happen to have ajaxDataTables enabled on that entity? If so - that's the problem - it's one of the many known and usolvable problems with ajaxDataTables.

@tabacitu, yes i know about this ajaxDataTables bug. But this one really comes from enableDetailsRow. When i remove enableDetailsRow it works even with ajaxDataTables enable.

@MarcosBL, thanks i'll have a look

Just as aditional info, I paste Gitter chat of this afternoon, as is related to this:

You can extended the search in the crud, and include aditional fields, and that's what I'm doing: I show 4-5 fields in the list, and define a custom search so I can search all othe fields I need, even seeing only those 4-5 fields in the list

image

something like allows me to access "notas" field both in search and in custom fields. That way, I can search by notes and get the companies that have that notes in the list, and as a plus, I also have access to those "notas" field in the custom fields, so I can set the title to show the notes, or show that special icon

image

If you enable ajax, and create that search() method in the crud controller, you can be able to search whatever fields you need. If also helps with the order.

So maybe we could have a

php $this->crud->includeFields = ['includeField1', 'includeField2'];
we could define and help with the bugs of the Ajax Datatable.

@MarcosBL , I was thinking of a similar solution $this->crud->searchColumns, but it might not be needed with the new search feature in https://github.com/Laravel-Backpack/CRUD/pull/445. Let's talk about that there and keep this issue for enableDetailsRow.

@adbmdp - I can't seem to be able to replicate your issue. When ajaxDataTables is off, my column reordering works with and without enableDetailsRow... Try a composer update maybe?

@adbmdp - I can't seem to be able to replicate your issue. When ajaxDataTables is off, my column reordering works with and without enableDetailsRow... Try a composer update maybe?

I've just upgrade to 3.2.10. Still got the bug.
Let me explain better:

  • ajaxDataTables ON and enableDetailsRow ON --> order on 'basic' text column don't works
  • ajaxDataTables ON and enableDetailsRow OFF --> order on 'basic' text column works
  • ajaxDataTables OFF and enableDetailsRow ON --> order on 'basic' text column works
  • ajaxDataTables OFF and enableDetailsRow OFF --> order on 'basic' text column works

Confirmed here (3.2.10), Datatables is ordering the wrong column due to a off by one bug when enableDetailsRow is On: if you click on the 2潞 column, it will order by the 3潞

For example, a click on "Hecha" sorts by "Comercial"

image

https://github.com/lloy0076/backpack-test/tree/r618b

Seems to work properly for me, i.e. I can't reproduce the problem.

I have the same problem by using AjaxDataTables and enableDetailsRow. Seems to be an issue with LiveControl\EloquentDataTable\DataTable.

@adbmdp Hi, the problem is solved?
I do not work even in these cases:

  • ajaxDataTables ON and enableDetailsRow ON
  • ajaxDataTables ON and enableDetailsRow OFF

Guys, can you please confirm this isn't a bug anymore in the latest Backpack versions? My tests have showed up fine. I'll close the issue and reopen it in case anybody says they're still having problems.

Cheers!

Still present

"backpack/crud": "^3.2",

image

+1

Hi guys - I specifically solved this yesterday in the all-new upgrade branch, which includes an overhaul of the ajax data tables. It'll be available as Backpack\CRUD 3.3 by the end of the week.

If you want to use it / test it until then, you can do that by using the version dev-upgrade in your composer.json file, then running composer update.

Thanks a lot, cheers!

@MarcosBL thanks for reopening it earlier!

Was this page helpful?
0 / 5 - 0 ratings