Buttons, API initialized, not showing when using Language file?

Buttons, API initialized, not showing when using Language file?

yurayyuray Posts: 2Questions: 2Answers: 0
edited November 2015 in Free community support

Hi when initializing DT this way, buttons are missing...

var tab= $('#table').DataTable({
    buttons: true,
    language: {
        url: "http://cdn.datatables.net/plug-ins/1.10.9/i18n/English.json"          
    },
});

tab.buttons().container().appendTo( '#buttonsContainer');

see: http://live.datatables.net/teyaduri/2/edit?html,js,output
- if you comment language part, buttons appear.

If i initialize them via "dom" they are here, but then i cannot place them outside generated "_wrapper".

Also, question is how can i "internalizate" these buttons. I understand i can define "text" property, but i would like to have that values in separate files, for each language.

thanks.
Y

Answers

  • allanallan Posts: 62,012Questions: 1Answers: 10,166 Site admin

    Hi,

    As the language.url documentation states:

    Note that when this parameter is set, DataTables' initialisation will be asynchronous due to the Ajax data load. That is to say that the table will not be drawn until the Ajax request as completed. As such, any actions that require the table to have completed its initialisation should be placed into the initComplete callback.

    So you need to wait for that callback: http://live.datatables.net/teyaduri/3/edit .

    Unfortunately you also need a small setTimeout because Buttons itself currently uses the init event itself. That is something I will fix in an upcoming release.

    Allan

This discussion has been closed.