Hi, I using this great package, when implement service render in te view with this line and Work fine.
{!! $dataTable->table([ 'id' => 'datatable', 'class' => 'table table-bordered]) !!}
But I want add more options like this javascript (not using service example)
<script>
$(function() {
$('#data-table').DataTable({
processing: true,
serverSide: true,
paging: true,
],
ajax: '{!! route('ventas.data') !!}',
order: [ [0, 'desc'] ],
columns: [
{data: 'id',"searchable":false, name: 'id'},
{data: 'name', name: 'name'},
{data: 'actions', "orderable": false, "searchable":false, visible: true, name: 'actions'},
],
"language": {
"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json"
}
});
});
</script>
For example languague to Spanish. I know adding this line via javascript works.
"language": {
"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json"
}
But how and where add this lines options using Service Implementation?
I tried pass parameter on this way, but not work
public function html()
{
return $this->builder()
->columns([
'id',
'name',
'actions',
])
->parameters([
'dom' => 'Bfrtip',
'order' => [ [0, 'desc'] ],
'buttons' => ['csv', 'excel'],
'language' => '"url: //cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json"'
]);
}
Any idea please...
I think you need to use array on the language param like:
public function html()
{
return $this->builder()
->columns([
'id',
'name',
'actions',
])
->parameters([
'dom' => 'Bfrtip',
'order' => [ [0, 'desc'] ],
'buttons' => ['csv', 'excel'],
'language' => ['url => '//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json']
]);
}
Thanks Yajra idol !! work fine in this way:
'language' => ['url' => '//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json']
Most helpful comment
Thanks Yajra idol !! work fine in this way:
'language' => ['url' => '//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json']