language + column search

language + column search

rstubberstubbe Posts: 3Questions: 2Answers: 0

I try to use both the column search and the language option.

When I use the example for column search https://datatables.net/examples/api/multi_filter.html it worjs.

As soon as i add the language option the search fails.

i made the following change:

var table = $('#example').DataTable( {
    language: {
        url: '//cdn.datatables.net/plug-ins/3cfcc339e89/i18n/Dutch.json'
    }
} );

Does anyone know how to fix this?

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    edited January 2015

    The example here
    http://datatables.net/examples/advanced_init/language_file
    includes "http:". Maybe that's the problem?

  • rstubberstubbe Posts: 3Questions: 2Answers: 0
    edited January 2015

    No tried that, also tried a local file, but always the same issue.

    For what i can tell, the text that you put in one colums for searching, is actually searched over all columns, resulting none or limited number of records returned.

    I have an example here: http://jsfiddle.net/rstubbe/drLjy4rt/

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

    My apologies - I misunderstood the question. I'm afraid I don't have an answer for you.

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Answer ✓

    You need to use the initComplete callback to build the filters. It isn't working when you include the language file since the language file is Ajax loaded - therefore the code for building the filter is running before the table has been fully created (the "A" in Ajax is for Asynchronous remember :-) ).

    Take a look at this example to see how to use initComplete.

    The example here http://datatables.net/examples/advanced_init/language_file includes "http:". Maybe that's the problem?

    I've only included the http there for people who are loading downloaded examples using file://. Using // is actually good practice since it means that the same protocol as the page was loaded with will be used (i.e. http or https - both work for the CDN). file:// however obviously won't work!

    Allan

This discussion has been closed.