lengthMenu Internationalization

lengthMenu Internationalization

gnulpgnulp Posts: 2Questions: 1Answers: 0

I'm using


    $(document).ready( function () {
        var table = $('#myTable1').DataTable({
            language: {
                url: '//cdn.datatables.net/plug-ins/2.3.6/i18n/de-DE.json',
            },
            lengthMenu: [15, 30, 100, -1],
            buttons: ['copy', 'csv', 'pdf', 'print'],
            dom: 'Blftrip',
        });
    } );

in some Joomla contend pages on a local WAMP server workinf fine.
After transfer to a hosted Joomla installation, the translation of the lengthMenu didn't work but the translation of the buttons is working fine.
I use as workaround


    lengthMenu: [ [15, 30, 100,  -1], [15, 30, 100,  "Alle"] ],

but I'm not happy with this

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 22,381Questions: 26Answers: 5,140
    Answer ✓

    I would start by making sure the downloaded de-DE.json is correct ad has this in the file:

    json "lengthLabels": { "-1": "Alle" },

    Possibly an incorrect JSON file is being downloaded or a cached version is being used that is incorrect. Is it possible to link to a test case that shows the issue so we can help debug?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • allanallan Posts: 65,467Questions: 1Answers: 10,874 Site admin

    I'd also suggest checking what version the hosted install is using.DataTable.version on the console should tell you, or use the debugger.

    Allan

  • gnulpgnulp Posts: 2Questions: 1Answers: 0

    Thank you,
    I made no changes, then checked the JSON, it was OK as expected. Removed the workaround, and, oh wonder, everything works fine as expected.

Sign In or Register to comment.