안녕하세요 유래 난 지금 지금 내가 문제가 발생하고 내 사무실의 모든 제품을 표시하는 것은 지금이 페이지를 가지고 있고 내가 여기에 datatables에게 서버 측 처리Laravel 4 Datatables 서버 측 처리
을 사용하는 웹 기반 프로젝트를하고있는 중이 야 보기 :
<table id="dloadTable" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>File ID Number</th>
<th>File Name</th>
<th>File Type</th>
<th>Date Issued</th>
<th>Uploader</th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>File ID Number</th>
<th>File Name</th>
<th>File Type</th>
<th>Date Issued</th>
<th>Uploader</th>
<th>Action</th>
</tr>
</tfoot>
</table>
컨트롤러 :
public function getAdvanceFilterData()
{
$files = Files::select(array('files.id','files.file_name','files.file_type','files.date','files.username'));
return Datatables::of($files)->make(true);
경로 :
Route::get('/getfilesdata', '[email protected]');
그리고 JS :
$(document).ready(function() {
var oTable = $('#dloadTable').DataTable({
processing: true,
serverSide: true,
ajax: {
url: '/getfilesdata',
dataSrc:""
},
order: [[1,'desc']],
columnDefs: [ { //this prevents errors if the data is null
targets: "_all",
defaultContent: ""
} ],
columns: [
{data: 'id', name: 'files.id'},
{data: 'file_name', name: 'files.file_name'},
{data: 'file_type', name: 'files.file_type'},
{data: 'date', name: 'files.date'},
{data: 'username', name: 'files.username'},
{data: 'action', name: 'action', orderable: false, searchable: false}
]
});
});
그리고 내가 JSON 데이터를 반환하지 않는 내가 무엇을 내가 기대하는 데이터를해야 그되지는 내가 내 컨트롤러의 내용물을 확인하려고 할 때? TIA
이'가 데이터베이스에서 테이블을 files' 귀하의 컨트롤러 클래스의 예? –
예 Peter가 내 데이터베이스에있는 테이블 중 하나의 이름이었습니다 –
'$ files'에 적절한 데이터가 있는지 확인 했습니까? –