Enable and use server side processing

parent c8149df1
...@@ -40,39 +40,10 @@ ...@@ -40,39 +40,10 @@
<th>{{ trans('core::core.table.thumbnail') }}</th> <th>{{ trans('core::core.table.thumbnail') }}</th>
<th>{{ trans('media::media.table.filename') }}</th> <th>{{ trans('media::media.table.filename') }}</th>
<th>{{ trans('core::core.table.created at') }}</th> <th>{{ trans('core::core.table.created at') }}</th>
<th data-sortable="false">{{ trans('core::core.table.actions') }}</th> <th>{{ trans('core::core.table.actions') }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php if ($files): ?>
<?php foreach ($files as $file): ?>
<tr>
<td>
<?php if ($file->isImage()): ?>
<img src="{{ Imagy::getThumbnail($file->path, 'smallThumb') }}" alt=""/>
<?php else: ?>
<i class="fa {{ FileHelper::getFaIcon($file->media_type) }}" style="font-size: 20px;"></i>
<?php endif; ?>
</td>
<td>
<a href="{{ route('admin.media.media.edit', [$file->id]) }}">
{{ $file->filename }}
</a>
</td>
<td>
<a href="{{ route('admin.media.media.edit', [$file->id]) }}">
{{ $file->created_at }}
</a>
</td>
<td>
<div class="btn-group">
<a href="{{ route('admin.media.media.edit', [$file->id]) }}" class="btn btn-default btn-flat"><i class="fa fa-pencil"></i></a>
<button class="btn btn-danger btn-flat" data-toggle="modal" data-target="#modal-delete-confirmation" data-action-target="{{ route('admin.media.media.destroy', [$file->id]) }}"><i class="fa fa-trash"></i></button>
</div>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
...@@ -104,16 +75,43 @@ ...@@ -104,16 +75,43 @@
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$('.data-table').dataTable({ $('.data-table').dataTable({
"paginate": true, "processing": true,
"lengthChange": true, "serverSide": true,
"filter": true, "ajax": '{{ route('api.media.all') }}',
"sort": true,
"info": true,
"autoWidth": true, "autoWidth": true,
"order": [[ 0, "desc" ]], "order": [[ 2, "desc" ]],
"language": { "language": {
"url": '<?php echo Module::asset("core:js/vendor/datatables/{$locale}.json") ?>' "url": '<?php echo Module::asset("core:js/vendor/datatables/{$locale}.json") ?>'
} },
"columns": [
{
data: 'thumbnail',
orderable: false,
searchable: false
},
{
data: 'filename',
render: function (data, type, full) {
return '<a href="' + route('admin.media.media.edit', {media: full.id}) + '">' + data + '</a>';
}
},
{
data: "created_at",
render: function (data, type, full) {
return '<a href="' + route('admin.media.media.edit', {media: full.id}) + '">' + data + '</a>';
}
},
{
data: null,
orderable: false,
searchable: false,
render: function (data, type, full) {
return '<a href="' + route('admin.media.media.edit', {media: full.id}) + '" class="btn btn-default btn-flat">' +
'<i class="fa fa-pencil"></i></a>' +
'<button class="btn btn-danger btn-flat" data-toggle="modal" data-target="#modal-delete-confirmation" data-action-target="' + route('admin.media.media.destroy', {media: full.id}) + '"><i class="fa fa-trash"></i></button>';
}
}
],
}); });
}); });
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment