6

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

Almaida Jody
  • 558
  • 2
  • 9
  • 19

1 Answers1

11

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

before ->make(true);

Jinal Somaiya
  • 1,931
  • 15
  • 29