I have a table with too much data. What I did was I added it as child rows to in order view. But when I want to export the contents of the table, the child rows are not included. Tried several solutions but none is working.
Here is my table
When I do export the data in the excel is only this one
I used the simple way of putting the buttons on the front end via
dom: 'Bfrtip',
buttons: [
{
extend: 'csv',
text: 'Export to CSV',
className: 'btn btn-default',
charset: 'utf-8',
fieldSeparator: ',',
bom: true,
filename: 'Corporates',
exportOptions: {
columns: ':not(.notexport)'
},}
],
In my controller, I simply return datatables function of yajra.
public function index(Request $request)
{
$corporate = Corporate::all();
if($request->ajax()){
return Datatables::of($corporate)
->addIndexColumn()
->addColumn('created_at', function ($row) {
return Carbon::createFromFormat('Y-m-d H:i:s', $row->created_at)->format('M d, Y');
})
->addColumn('buttons', function ($row) {
return '<a href="'.route('admin.corporate.edit',$row->id).'" class="btn btn-primary"> Update</a> <button onclick="deleteCorporate('.$row->id.')" class="btn btn-danger">Delete</button>';
})
->rawColumns(['buttons'])
->make(true);
}
return view('corporate.index');
}
Does anyone know what I missed or what to do? Thanks in advance.