Loading the language files makes DataTables to do not work normally

Loading the language files makes DataTables to do not work normally

manutiedramanutiedra Posts: 2Questions: 0Answers: 0

Hi,

If I have a DataTable in the page and I step over it with the debugger, as soon as it executes this line:

table = curr_element.DataTable(config);

you can see all the elements created and the table styled properly. However, If I add to the config object the following:

config.language = {
            url: language_file
};

then in the call to curr_element.DataTable(config) some styles are applied but not all, and not all the elements are created. For example, the #myId_length element is not yet created, so I can't do anything like adding the buttons where I want.

After a while, when the page completes loading, the default lenght, filter, and pagination elements are created and work fine, but they were not created when I needed to access them, just after DataTable creation

So it seems that you don't fully create the DataTable when loading to a language. Maybe you wait until the file is retrieved and finish the creation then.

When can I access the table elements safely when using a language.

Thank you

Replies

  • manutiedramanutiedra Posts: 2Questions: 0Answers: 0

    Just to reply myself, I've got it working using the initComplete event

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Thanks for posting back. initComplete is the correct way to handle this.

    Allan

This discussion has been closed.