Language Configuration via data-*

Language Configuration via data-*

onestoneonestone Posts: 4Questions: 1Answers: 0

Hi threre, I'm looking for a way to use HTML5 data-* attributes to configure the language of dataTables. Any chance that I can do it this way?
Cheers

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,684Questions: 1Answers: 10,498 Site admin
    edited February 2015 Answer ✓

    You can do this using data-language which would contain JSON information - e.g.: data-language='{"info":"_START_ - _END_ of _TOTAL_"}'.

    Example: http://live.datatables.net/zigeraxu/1/edit

    Note that this requires DataTables 1.10.5+.

    Allan

  • onestoneonestone Posts: 4Questions: 1Answers: 0

    That's it! Appreciate your help. Thanks a lot.

  • onestoneonestone Posts: 4Questions: 1Answers: 0

    I found out, that I cannot use single-quotet attributes in my environment. Is there a workaround for double-quotes?

  • allanallan Posts: 63,684Questions: 1Answers: 10,498 Site admin
    Answer ✓

    No - that is how jQuery.data() operates. You need to use valid JSON in the attribute.

    Allan

  • onestoneonestone Posts: 4Questions: 1Answers: 0
    edited February 2015

    Something like
    data-language-info="_START_ - _END_ of _TOTAL_"
    would be nice...

This discussion has been closed.