Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How translate render in View using Datatable Service? #557

Closed
alejandri opened this issue May 16, 2016 · 4 comments
Closed

How translate render in View using Datatable Service? #557

alejandri opened this issue May 16, 2016 · 4 comments
Labels

Comments

@alejandri
Copy link

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?

  • Operating System Win7 Xampp 3.2.1
  • PHP Version 5.6
  • Laravel Version 5.2
  • Laravel-Datatables Version 6
@alejandri
Copy link
Author

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...

@yajra
Copy link
Owner

yajra commented May 17, 2016

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']
            ]);
    }

@yajra yajra added the question label May 17, 2016
@alejandri
Copy link
Author

Thanks Yajra idol !! work fine in this way:
'language' => ['url' => '//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json']

@ahmed-ibrahim1998
Copy link

ahmed-ibrahim1998 commented Apr 10, 2022

good docs my friends but not trans all page such all button (create, reset , reload,.....), not translation

image

@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants