How can I create a condition in the ajax or controller
How can I create a condition in the ajax or controller
jorgearagon32
Posts: 1Questions: 1Answers: 0
my problem is that in a column of a table it comes true or false, and I need that if it comes true it will be shown and if it comes false it will not.
I know this is wrong but so that you can see a clear example of what I want to do.
$('#myTable').DataTable( {
ajax: ...,
if(name) {
columns: [
{ data: 'name' },
{ data: 'hr.position' },
{ data: 'hr.salary' },
{ data: 'hr.state_date' },
{ data: 'contact.office' },
{ data: 'contact.extn' }
]
}
} );
or in controller
return DataTables::of($did)
"" ->where('name', ''=', 'false') ""
->rawColumns(['actions'])
->make(true);
Thanks for the help
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
What would you expect to be shown in that column of the table if it is
false
? It would be worth looking atcolumns.render
as that might get you moving in the right direction,Colin