Javascript 来自原始查询的数据表
我在视图中有一个datatable,它是服务器处理的,因为该表有几千条记录。我曾尝试使用eloquent获取数据,但一汽最简单的是原始SQL 我的观点是Javascript 来自原始查询的数据表,javascript,laravel-5,datatables,Javascript,Laravel 5,Datatables,我在视图中有一个datatable,它是服务器处理的,因为该表有几千条记录。我曾尝试使用eloquent获取数据,但一汽最简单的是原始SQL 我的观点是 <table id="thetable" class="table table-striped table-bordered" width="90%" align="center" cellspacing="5px" cellpadding="10px" > <thead> <th&
<table id="thetable" class="table table-striped table-bordered" width="90%" align="center" cellspacing="5px" cellpadding="10px" >
<thead>
<th>ID</th>
<th>PartNo</th>
<th>Description</th>
<th>ManufacturerName</th>
<th>accountcode</th>
</thead>
</table>
</div>
<script>
$('#thetable').DataTable({
dom: 'lBfrtip',
"iDisplayLength": 30,
"lengthMenu": [ 10, 25,30, 50, 75, 100,200 ],
buttons: [
'copy', 'print',
{extend: 'excel',
filename: 'PartDetails', footer:true},
{extend: 'pdf',
filename: 'PartDetails'},
{extend:'csvHtml5',
filename: 'PartDetails'},
{extend: 'collection',
text: 'columns',
buttons:['columnsVisibility'] }
],
processing: true,
serverSide: true,
ajax:
{url: ' {{ route('partdetails.serverSide') }}',
type: 'GET' }
}) ;
</script>
如果我添加了$parts,那么这一切都是正确的,datatables中的myh列也是完全正确的,但是我得到了一个ajax错误
DataTables warning: table id=thetable - Ajax error. For more information about this error, please see http://datatables.net/tn/7
表和名称完全正确。这是因为我使用的是DB select吗?您可以在浏览器中打开并查看是否能够查看服务器响应吗?我在EloquentEngine.php第22行:调用数组上的成员函数getQuery()时遇到错误
FatalErrorException
DataTables warning: table id=thetable - Ajax error. For more information about this error, please see http://datatables.net/tn/7