Support the ongoing development of Laravel.io →
Packages Database
Last updated 1 year ago.
0

You can check the value returned by the "datatableClientes" controller method. Do something like these:

public function datatableClientes() {

        $todos = DB::table('crm_cliente AS c')
                                   ->select('c.tipo','c.nome_fantasia','c.razao_social','c.numero_funcionarios')
                   ->where('c.cod_categoria','=', '1');

        $retorno = Datatables::of($todos, true)         
                           ->add_column('ver', 'See Image')
                           ->add_column('editar', 'Edit Image')
                           ->add_column('apagar', 'Delete Image')                       
                           ->make();
        dd($retorno);

        return $retorno;

    }

To see the results, you'll need to acces de route direct from the browser (domain.com/clientes/datatable-clientes). The page will dump de content of the return, wich is expected to be a valid JSON.

If everything is ok, the problem probaly is in your JS script...

0

I make the test and the return was this:

Array ( [0] => datatable-clientes )

Should be a JSON, right?

0

Why don't you use regular html tables where you have full control over everything? I would never ever ever use a third party table gen, because I know php and html, and css.

0

I liked the plugin and his functions (pagination, filter, column reorder...), so I want to use it in my app.

I just want help to resolve this problem.

Last updated 9 years ago.
0

destrutorx said:

I make the test and the return was this:

Array ( [0] => datatable-clientes )

Should be a JSON, right?

Default collections (returned by Eloquent, for example) in Laravel are automatically converted to JSON when returned from controller/route. Blim package, as far I can see, should return JSON to... But looking at your response, it returned an array instead.

Try to make this test again, but now dump de query result (don't forget to add "->get()" to it). It should return a JSON. If yes, probably is some error with Blim package. In this case, you'll need to read the documentation to understand why.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

destrutorx destrutorx Joined 13 Jan 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.