Problem with search field, renderers table fields
Problem with search field, renderers table fields
Kumaetsu
Posts: 6Questions: 3Answers: 0
Hello, implement a data table and everything works fine, implement a renderer to concatenate 2 data into a single field of the table, and everything works well, the problem comes is when I try to look for something in the search field returns me the following error , could you help me solve it
frontend:
{ data: null, render: function ( data, type, row ) {
// Combine the first and last names into a single table field
return data.autorName+' '+data.autorLastname;
} },
backend:
$query = App\Informe::query()
//->join('user_t_o_i_s','user_t_o_i_s.id','informe.userTOI_id');
->select([
'informes.id',
'informes.clave_IPH',
'informes.userTOI_id',
'informes.created_at',
'informes.typeIPH_id',
'informes.status',
'user_t_o_i_s.name as autorName',
'user_t_o_i_s.first_lastname as autorLastname',
'type_i_p_h.tipoIPH as tipo'
])
->leftJoin('user_t_o_i_s', 'informes.userTOI_id', '=', 'user_t_o_i_s.id')
->leftJoin('type_i_p_h', 'informes.typeIPH_id', '=', 'type_i_p_h.id');
return datatables($query)
->addColumn('btn','Informes.actionsInformesTOI')
->rawColumns(['btn'])
->toJson();
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Answers
You didn't post the error. Are you also able to link to a page that demonstrates the issue, please.
Colin
I don't recognise that PHP API (its not one of ours), so I'm not sure how much I can help, but I would suggest outputting the generated SQL and the bindings so you can see what SQL is being created and what is wrong with it.
Allan
I am implementing data table in Larvel, from there comes PHP bakend, what I did was concatenate 2 variables (Name and surname) to be shown together in the table, but that generated the error in the algorithm of "search", tell me if there is any solution or if there is some other way to concatenate information without affecting the "Search" algorithm, thanks
I don't know I'm afraid as we didn't write that Laravel backend. You'd be best asking the author of those libraries.
In DataTables client-side you can use a renderer to combine data. That will probably workaround the issue in this case.
Allan