Yajra DataTable addColumn
Asked Answered
B

1

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

Bevbevan answered 5/6, 2018 at 12:12 Comment(2)
Instead of sending using double quotes, use single quotes. Like you used for previous column "Process".Dead
these are 2 different column.. how could I use single "addColumn" ?Bevbevan
Z
11

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

before ->make(true);

Zygodactyl answered 21/6, 2018 at 12:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.