【发布时间】:2017-04-15 15:11:55
【问题描述】:
我在 Laravel 5.4 中使用单个数据表,因为它已经在 Laravel 框架中实现。我的数据表正在使用查询生成器来获取数据,例如使用这样的东西:
@section('content')
<div class="container">
<table id="services" class="table table-hover table-condensed" style="width:100%">
<thead>
<tr>
<th> </th>
<th>Id</th>
<th>Plate</th>
<th>Brand</th>
<th>Year</th>
</tr>
</thead>
</table>
</div>
<script type="text/javascript">
$(document).ready(function() {
table = $('#services').DataTable({
"processing": true,
"serverSide": true,
"ajax": "{{ route('datatable_ser.getdata') }}",
"columns": [
{data: 'id', name: 'id'},
{data: 'plate', name: 'plate'},
{data: 'brand', name: 'vehicle.brand'},
{data: 'year', name: 'vehicle.year'},
]
});
});
</script>
@stop
为了让它正常工作,我必须包含这个文件:
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
由于 Laravel 中包含数据表,它从 bootstrap 中获取 css,从 laravel 中安装的数据表包中获取 javascript。
现在,阅读row detail documentation 有点不清楚,在我的情况下如何实现行详细信息。我必须在代码中添加什么?我必须包含更多文件吗?
与每行的Edit 或Remove 按钮的其他功能相同。 Laravel 本身没有数据表的文档,所以现在做什么有点令人困惑。感谢您的帮助。
【问题讨论】:
-
Row Detail 在您即将显示自定义行详细信息时使用。但是还有另一个可用的 api DataTable Responsive 做同样的事情,显示行详细信息 w.r.t 屏幕尺寸。
-
我很确定有很多功能可以用来做行细节,但我想用 API 做一个但没有运气。
标签: laravel datatables