• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

269
Vistas
Yajra/JQuery datatable exporting child rows into CSV

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

enter image description here

When I do export the data in the excel is only this one

enter image description here

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> &nbsp; <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.

almost 3 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda