I am having a problem using datatables server side.
I have a route for the datatables of
Route::get('partdetails.serverSide',function(){
$pdomodel = new PDOModel();
$pdomodel->connect("localhost", "root", "*password*", "DBName");
$pdomodel->limit = "0,200";
$db_parts = $pdomodel->select('v_masterpartslist');
$dbparts = collection($db_parts);
return Datables::of($dbparts)->make();
})->name('partdetails.serverSide');
The pdomodel returns a 2D array quite correctly and in my view I have (I have tried using this without collection):
@section('content')
<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>Manufacturer</th>
<th>code</th>
<th></th>
<th></th>
<th></th>
</thead>
</table>
@endsection
@section('scripts')
<script>
$('#thetable').DataTable({
dom: 'lBfrtip',
"iDisplayLength": 30,
"lengthMenu": [ 10, 25,30, 50, 75, 100,200 ],
buttons: [
'copy', 'print','colvis',
{ extend: 'excel',filename: 'stock', footer:true},
{ extend: 'pdf',filename: 'stock'},
{ extend:'csvHtml5',filename: 'stock'}
// { extend: 'create', editor: editor },
// { extend: 'edit', editor: editor },
// { extend: 'remove', editor: editor }
],
processing: true,
serverSide: true,
ajax:
{url: ' ',
type: 'GET' },
columnDefs: [
{'orderable':false, "targets": [5] },
{'orderable':false, "targets": [6] },
{
"targets": 5,
"render": function ( data, type, full, meta ) {
{return '<div align="center"><a href="#"><img src="" id="trigger" onclick="ShowSlider(' + full[0] + ')"></a></div>';}
}
},
{
"targets": [6],
"render": function ( data, type, full, meta ) {
{return '<div align="center"><a href="#"><img src=""></a></div>';}
}
},
{
"targets": [7],
"render": function ( data, type, full, meta ) {
{return '<div align="center"><a href="#"><img src=""></a></div>';}
}
}
]
}) ;
</script>
When I try this I am getting an ajax error 404. The route exists and works fine but it cannot render.
I really need help here!
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2liydg8
via IFTTT
Aucun commentaire:
Enregistrer un commentaire