Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yajra DataTable addColumn

I use yajra datatable but i've get problem when I use the method "addColumn". the one I use that method is work properly, but the other doesn't

this is my source code :

        ->addColumn('action', function($arrProduct){
          return
              '<center><a class="btn btn-success btn-sm"  href="'.route('packaging.edit',['id' => $arrProduct['id'], 'product_id'=> $arrProduct['product_id']]).'">
                  <i class="fa fa-refresh"></i>&nbsp;Proses</a></center>';
        })
        ->addColumn('status', function($arrProduct){
            if($arrProduct['status_produksi']){
              return ucwords($arrProduct['status_produksi']);
            }else{
              $tag = "<center><a class='btn btn-danger btn-sm'>
                  <i class='fa fa-refresh'></i>Belum Diproses</a></center>";
              return $tag;
            }
        })
        ->make(true);

and this is the problem : enter image description here

one of them (column action) is work properly, but why in the other (column status) the "addColumn" doesn't work?

pls somebody help me.. thank's anyway

like image 415
Almaida Jody Avatar asked Jan 03 '23 07:01

Almaida Jody


1 Answers

Add ->rawColumns(['status', 'action'])

before ->make(true);

like image 74
Jinal Somaiya Avatar answered Jan 05 '23 17:01

Jinal Somaiya