【发布时间】:2020-01-10 03:11:47
【问题描述】:
我获取所有数据的控制器。
return Datatables::of($usersData)->make(true);
在观点上:
<table id="AllData" class="table table-striped display" cellspacing="0" width="100%" >
<thead>
<tr>
<th>Subject</th>
<th>Business</th>
<th>Device</th>
</tr>
</thead>
</table>
然后是 JavaScript
<script type="text/javascript">
$(document).ready(function() {
$('#AllData').DataTable({
dom: 'Bfrtip',
aLengthMenu: [[5, 10, 25], [5, 10, 25]],
iDisplayLength: 10,
processing: true,
serverSide: true,
responsive: true,
autoWidth:false,
"ajax": "{{ url('get-all-review-data') }}",
"columns":[
{ "data": "subject"},
{ "data": "businessName" },
{ "data": "device_name" }
],
buttons: ['csv', 'excel', 'pdf', 'colvis']
});
});
</script>
这很好用。我可以查看数据。
但是,我希望将第一个 td 作为链接作为<td><a href="/review/show/{!! >reviewSlug !!}" target="_blank">{!! subject !!}</a></td>
我怎样才能做到这一点?
【问题讨论】:
标签: laravel laravel-5 yajra-datatable