laravel4-datatables-package icon indicating copy to clipboard operation
laravel4-datatables-package copied to clipboard

Column entries results duplicated

Open akizor opened this issue 11 years ago • 2 comments

Greetings,

I'm encountering an issue with Datatables. No mater what columns I select, the output in aaData block is duplicated for each element. Code used:

$users = User::select('users.id', 'users.username', 'users.confirmed');
return Datatables::of($users)
   ->make();

Output:

[

    "1",
    "1",
    "akizor",
    "akizor",
    "1",
    "1"

],

How can i solve this?

akizor avatar Dec 10 '14 10:12 akizor

Using ->make(true) it returned:

{

    "0": "1",
    "1": "akizor",
    "2": "1",
    "id": "1",
    "username": "akizor",
    "confirmed": "1"

},

akizor avatar Dec 10 '14 10:12 akizor

This can be solved by using columns attribute in javascript Datatables and using ->make(true) when generating json for it. But still looking for solution for the first post.

akizor avatar Dec 10 '14 10:12 akizor