我在国家/地区表中显示了列名称,现在我使用 yajra 数据表,所以我如何查看 yes 而不是 y 以及 , No if n
$data = $this->SourceData->getData();
return Datatables::of($data)
->addIndexColumn()
->addColumn('Actions', function($data) {...})
->rawColumns(['Actions'])
->make(true);
jquery
columns: [
{data: 'id', name: 'id', visible:false},
{data: 'DT_RowIndex', name: 'DT_RowIndex'},
{data: 'name', name: 'name'},
{data: 'code', name: 'code'},
{data: 'show', name: 'show'},
{data: 'Actions', name: 'Actions',orderable:false,serachable:false,sClass:'text-center'},
最佳答案
请检查此代码
$data = $this->SourceData->getData();
return Datatables::of($data)
->addIndexColumn()
->editColumn('show', function ($data) {
return ($data->show == 'y')?"Yes":($data->show == 'n')?"No":"";
})
->addColumn('Actions', function($data) {...})
->rawColumns(['Actions'])
->make(true);
关于php - Laravel,Yajra 数据表,如何返回 if y then Yes else No,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59839221/