I am using a single datatable in Laravel 5.4 since it is already implemented in the Laravel framework. My datatable is using query builder to get data, for example using something like this:
@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": "",
"columns": [
{data: 'id', name: 'id'},
{data: 'plate', name: 'plate'},
{data: 'brand', name: 'vehicle.brand'},
{data: 'year', name: 'vehicle.year'},
]
});
});
</script>
@stop
And to get it working proberly, I have to include those files:
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.2.4/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.2.4/js/buttons.colVis.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/responsive/2.1.1/js/dataTables.responsive.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/select/1.2.0/js/dataTables.select.min.js"></script>
Now, reading row detail documentation it is a bit unclear, how can I achieve row details in my case. What do I have to add into the code? Do I have to include some more files?
Same with other features as Edit
or Remove
buttons for each row. Laravel itself doesn't have documentation for datatables so it is a bit confusing what to do now. Thanks for help.
via Ady96