Search code examples
laravel-5yajra-datatable

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


Solution

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

    before ->make(true);