[英]Render html in yajra datatables using laravel 5.4
我在數據表中顯示圖像時遇到問題。 下面的代碼在該列旁邊顯示了整個html(未呈現HTML)。 它曾經與laravel 5.3及更低版本一起使用。 如何使其與laravel 5.4一起使用。 謝謝。
$data = Member::query()
->get();
return Datatables::of($data)
->addColumn('picture', function ($data) {
return '<img src=" '.$data->picture.' "/>';
})
->make(true);
好的,我找到了只需要在->make(true)
之前添加->rawColumns()
的解決方案
->rawColumns(['picture', 'confirmed'])
在返回時。 干杯!!
您必須在img標簽中定義圖像的完整src
Like this
<img style="width: 140px;" src="/images/your-folder-name/'.$data->pictur.'">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.