Chumper / Datatable

This is a laravel 4 package for the server and client side of datatables at http://datatables.net/
https://github.com/Chumper/Datatable
388 stars 154 forks source link

Fixed for L5.2 compatibility #372

Closed mmestrovic closed 8 years ago

mmestrovic commented 8 years ago

L5.2 has some changes in Illuminate\Support\Collection, so chumper/datatables Collection-based table doesn't work as expected. When you have paginated table, it works well on first page (returns array as expected), but if you try to get results on any other page, it returns an object, which can't be shown in table, because table expects array, so you get empty table window.

More information on changes in L5.2 Illuminate\Support\Collection can be found on following links:

mmestrovic commented 8 years ago

Before fix: http://localhost/laravel52/public/user/datatable?iDisplayStart=0&iDisplayLength=10 {"aaData":[[1],[2],[3],[4],[5],[6],[7],[8],[9],[10]],"sEcho":0,"iTotalRecords":100,"iTotalDisplayRecords":100}

http://localhost/laravel52/public/user/datatable?iDisplayStart=1&iDisplayLength=10 {"aaData":{"1":[2],"2":[3],"3":[4],"4":[5],"5":[6],"6":[7],"7":[8],"8":[9],"9":[10],"10":[11]},"sEcho":0,"iTotalRecords":100,"iTotalDisplayRecords":100}

After fix: http://localhost/laravel52/public/user/datatable?iDisplayStart=0&iDisplayLength=10 {"aaData":[[1],[2],[3],[4],[5],[6],[7],[8],[9],[10]],"sEcho":0,"iTotalRecords":100,"iTotalDisplayRecords":100}

http://localhost/laravel52/public/user/datatable?iDisplayStart=1&iDisplayLength=10 {"aaData":[[2],[3],[4],[5],[6],[7],[8],[9],[10],[11]],"sEcho":0,"iTotalRecords":100,"iTotalDisplayRecords":100}

timgws commented 8 years ago

I am not sure, but is ->values() supported in Laravel 5.1?

mmestrovic commented 8 years ago

@timgws: ->values() is supported in L5.x. I tried this fix on 5.0, 5.1 and 5.2, it works as expected.

timgws commented 8 years ago

Thanks @mmestrovic 👍

josebailo commented 8 years ago

OMG! Hours spent searching the solution for this...

Why is this fix not merged on develop branch if it's supposed the branch for L5?

timgws commented 8 years ago

That's my bad. Thanks for doing the additional PR

---- On Thu, 21 Jul 2016 19:33:53 +1000 notifications@github.com wrote ----

OMG! Hours spent searching the solution for this...

Why is this fix not merged on develop branch if it's supposed the branch for L5?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.