Other languages block filters

Other languages block filters

kleposhopkleposhop Posts: 13Questions: 0Answers: 0
edited June 2015 in Free community support

When i change language filters don't work please help :)

$('#example').dataTable({
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sSwfPath": "swf/copy_csv_xls_pdf.swf"
},
"processing": true,
"serverSide": true,
"ajax": {
"url": "post.php",
"type": "POST"
},
"columns": [
{"data": "kids_id"},
{"data": "kids_firstname"},
{"data": "kids_surname"},
{"data": "kids_lastname"}
],
"language": {
"url": "bg.json"
}
});

when i remove
"language": {
"url": "bg.json"
}

filter workds.

Replies

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    Two points:

    1. Please don't hijack other threads
    2. Please follow the forum rules are link to a test case showing the issue so we can debug it

    Thanks,
    Allan

  • kleposhopkleposhop Posts: 13Questions: 0Answers: 0

    Ok sorry, but can you help me.

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    Sure we can help - just follow the rules I and tangerine have noted. Link to a test case showing the issue so it can be debugged.

    Allan

  • kleposhopkleposhop Posts: 13Questions: 0Answers: 0

    and also i have utf-8 problem when i export table to pdf.

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    and also i have utf-8 problem when i export table to pdf.

    Search for the forum file "pdf utf8" and you'll find a lot of posts on this topic. A new plug-in will be released in a few weeks time that will address this.

    Thank you for the code, but if you could please link to a test page showing the issue so we can debug it, I would be happy to help.

    Allan

  • kleposhopkleposhop Posts: 13Questions: 0Answers: 0

    Its simple when i add language the filters stop working

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    Very likely you need to initialise the filters in initCallback.

  • kleposhopkleposhop Posts: 13Questions: 0Answers: 0

    Thank you. Now i need to save the filter value on page refresh.

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
  • kleposhopkleposhop Posts: 13Questions: 0Answers: 0
    edited June 2015

    I'm using this its working, but after the refresh its not saving the filter value.
    my code is same i only added:
    LINK - https://gist.github.com/anonymous/3a1f3422e03f0816ac86

  • kleposhopkleposhop Posts: 13Questions: 0Answers: 0

    Please help

  • kleposhopkleposhop Posts: 13Questions: 0Answers: 0

    I also want to add custom column with buttons

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    Please use JSFiddle or https://live.datatables.net/ to post a working test case showing the issue so we can offer some help, as has been requested a number of times in this thread.

  • kleposhopkleposhop Posts: 13Questions: 0Answers: 0
    edited June 2015

    How to do it? I tried.

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    http://live.datatables.net/

    Your HTML in the HTML panel, your JS in the JavaScript panel....

  • kleposhopkleposhop Posts: 13Questions: 0Answers: 0
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Your examples don't work because you haven't included references to jQuery.

  • kleposhopkleposhop Posts: 13Questions: 0Answers: 0
    edited July 2015

    Thank you all for help.

  • LoloLolo Posts: 42Questions: 7Answers: 1

    Hello,

    I have exactly the same problem.
    Simple adding the following piece of code break the filter functionnality:

    "language": {
        "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"
    }
    

    And strangely, using direct initialization does not break filter.

    "language": {
                "lengthMenu": "Display _MENU_ records per page",
                "zeroRecords": "Nothing found - sorry",
                "info": "Showing page _PAGE_ of _PAGES_",
                "infoEmpty": "No records available",
                "infoFiltered": "(filtered from _MAX_ total records)"
            },
    

    I a using DataTables v1.10.8
    You can find a test code here: https://jsfiddle.net/jgz0yzme/

    Can you confirm this behavior please and if yes, is it a bug.
    Thanks in advance for your answer.

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    edited August 2015

    There is no bug here. You need to use initComplete to execute code after the table has been initialised if you are loading asynchronous information (as you are if you use language.url).

    See this example.

    The language.url documentation does have a note about this:

    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.

    Allan

This discussion has been closed.