【发布时间】:2016-01-08 11:06:19
【问题描述】:
所以我正在尝试使用下面编写的代码中的数据表。不幸的是,由于一些未知的原因,排序、搜索和分页功能不起作用。我可以知道我错过了什么或它不起作用的原因吗?
@extends('app')
@section('header')
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.datatables.net/1.10.10/css/dataTables.bootstrap.min.css" rel="stylesheet">
@stop
@section('content')
<h1 class="page-header">View Log Information</h1>
<br/>
<div class="container">
<div class="col-xs-12 col-md-12" style="overflow:auto">
<table class="table table-hover" id="logTable">
<thead>
<tr>
<th>
User
</th>
<th>
Log Description
</th>
<th>
Time Stamp
</th>
</tr>
</thead>
@foreach ($logs as $log)
<tbody>
<tr>
<td>
{{ App\User::find($log->user_id)->name }}
</td>
<td>
{{ $log->log_description }}
</td>
<td>
{{ date("F d Y - g:i a",strtotime("$log->created_at")) }}
</td>
</tr>
</tbody>
@endforeach
</table>
</div>
</div>
@stop
@section('scripts')
<!-- Bootstrap Based Data Table Plugin Script-->
<script src="http://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>
<script src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.10/js/dataTables.bootstrap.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$('#logTable').DataTable();
} );
</script>
@stop
【问题讨论】: