Footer functions don't work when JSON language file is used

Footer functions don't work when JSON language file is used

toxpaltoxpal Posts: 10Questions: 1Answers: 0

After spending hours trying to insert total of all values in specified columns ( as per example in https://datatables.net/reference/api/column().footer() ) I couldn't get it to work. After debugging I found out this:

Function only works when language option is not used (or translations are provided as arguments instead of URL with JSON file). My first thought was that localization file was corrupt, but I noticed it happens with all "official" translation files.

I made an example, where total of "Age" column is added to the footer of the same column, it works fine:
http://live.datatables.net/nukaqaqe/1/edit

Now see what happens if I configure DataTables to use JSON file with translations ( as per instructions on https://datatables.net/plug-ins/i18n/ )
http://live.datatables.net/depopoqo/1/edit (custom content is not added to footer).

I strongly believe this is a bug, unless I missed something?

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    I think you missed this part of the language.url documentation:

    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 has completed. As such, any actions that require the table to have completed its initialisation should be placed into the initComplete callback.

    Here is your example using initComplete: http://live.datatables.net/depopoqo/2/edit .

    Allan

  • toxpaltoxpal Posts: 10Questions: 1Answers: 0

    Thank you, that really was the reason why footer function didn't work.

Sign In or Register to comment.