I have a problem with adding column into the jquery.datatables.
My datatable function looks like this
public function getSliderImages()
{
$query = Slider::with('User')->select('sliders.*');
return Datatables::of($query)
->addColumn('fullName',function ($data){
return $data->user->firstName .' '. $data->user->lastName;
})
->addColumn('types',function ($data){
return '<ul class="list-condensed list-unstyled no-margin">' .
'<li><span class="text-semibold">Boyut:</span> '.$data->size.'</li>' .
'<li><span class="text-semibold">Format:</span> ' .$data->ext.'</li></ul>';
})
->make(true);
}
The returning json file is pretty good however here is the problem
My datatable looks like this
And last thing is my javascript
columns: [
{data: 'slider_slug', name: 'slider_slug',"render": function(data, type, row) {
return '<a href="'+loc+'/'+data+'" data-popup="lightbox"> <img src="'+loc+'/'+data+'" class="img-rounded img-preview" </a>';
},
orderable: false,
searchable: false
},
{data: 'slider_slug', name: 'slider_slug'},
{data: 'fullName', name: 'fullName'},
{data: 'created_at', name: 'created_at'},
{data: 'action',name:'action'},
{data: 'types',name:'types'},
The returning value is acts like a plain text but its html.
In the javascript I couldnt get 2 data from server.I mean I cannot get 2 variables in 1 row.
How can I solve this problem