Buttons disappear when language url is loaded instead of code

Buttons disappear when language url is loaded instead of code

matolamatola Posts: 23Questions: 6Answers: 1
edited January 2019 in Buttons

Hi,

When initializing datatables I use language : <json stuff>
However, if I set url : <file.json> (with same contents, in this case Swedish.json downloaded from datatables.net) then the buttons disappear.

Check out debug code ovelax

Best regards,
Mats

{
      "sEmptyTable": "Tabellen innehåller ingen data",
      "sInfo": "Visar _START_ till _END_ av totalt _TOTAL_ rader",
      "sInfoEmpty": "Visar 0 till 0 av totalt 0 rader",
      "sInfoFiltered": "(filtrerade från totalt _MAX_ rader)",
      "sInfoPostFix": "",
      "sInfoThousands": " ",
      "sLengthMenu": "Visa _MENU_ rader",
      "sLoadingRecords": "Laddar...",
      "sProcessing": "Bearbetar...",
      "sSearch": "Sök:",
      "sZeroRecords": "Hittade inga matchande resultat",
      "oPaginate": {
        "sFirst": "Första",
        "sLast": "Sista",
        "sNext": "Nästa",
        "sPrevious": "Föregående"
      },
      "oAria": {
        "sSortAscending": ": aktivera för att sortera kolumnen i stigande ordning",
        "sSortDescending": ": aktivera för att sortera kolumnen i fallande ordning"
      }
}

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Thanks for your question. As noted in the forum rules, please post a link to a test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Allan

  • belubelu Posts: 38Questions: 14Answers: 0

    Hi Matola,
    I have the same problem. Could you solve it?

    thx
    Bernhard

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @belu ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • GreenEyedGreenEyed Posts: 2Questions: 0Answers: 0
    edited January 2019

    Hi there,
    I've had quite a similar issue that looks that it's related, so here it comes.
    I followed the guide Individual column searching (text inputs) and the filters were working fine until I added the language {url:...} option to the table. Then the filter never matches any record. I've isolated all options to the table and it's the only change to break it.

    I created a test case so you can have a look a it: Test case. If you comment the language option, the filters work fine, if you uncomment the line, the filters never match.

    Cheers,
    D.

    PS: Using version 1.10.19, just to clarify ;).

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    As the language.url documentation says:

    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.

    Updated example with that: http://live.datatables.net/yibojipu/2/edit

    Allan

  • belubelu Posts: 38Questions: 14Answers: 0

    Hi,

    @allan : Thanks a lot, that helped - I initialized the buttons within the initComplete und it worked. I am very grateful for that help!

    @GreenEyed : the column searching works fine as well in this constellation!

  • GreenEyedGreenEyed Posts: 2Questions: 0Answers: 0

    @allan Thanks, that explains it. I moved the code inside the initComplete and that was it.

This discussion has been closed.