Closed mmestrovic closed 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}
I am not sure, but is ->values()
supported in Laravel 5.1?
@timgws: ->values()
is supported in L5.x. I tried this fix on 5.0, 5.1 and 5.2, it works as expected.
Thanks @mmestrovic 👍
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?
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.
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: