Cannot extract column data when using server side processing

Cannot extract column data when using server side processing

ierpeierpe Posts: 6Questions: 1Answers: 0
edited April 2014 in DataTables 1.10
Hi,

I'm trying to achieve select filtering while using server side processing, but it's not working and I do not have any error message.
If someone could help me figuring out what's wrong...

I'm following this documentation page : https://next.datatables.net/examples/api/multi_filter_select.html

Basically the select is added but not filled with any data.
The :
[code]
table.column(i).data().unique().sort().each(function(d, j) {
console.log(d);
});
[/code]
is not printing anything.

Any idea what's wrong? Is this working for you guys?

My datatable init looks like this :
[code]
var table = $('table#test').DataTable({
"processing": true,
"serverSide": true,
"ajax": "<?php echo $my_ajax_url?>",
"stateSave": true,
});
[/code]

Replies

  • allanallan Posts: 61,715Questions: 1Answers: 10,106 Site admin
    You need to use `initComplete` to add the filter. The issue is that you are running your code to get the data before the data has been loaded (remember what the first character in 'Ajax' stands for!!).

    Also be aware that the filter will only show the data for the current page if you do it that way with server-side processing enabled, since the whole point of server-side processing is to only show the data needed for the current page.

    Allan
  • ierpeierpe Posts: 6Questions: 1Answers: 0
    edited April 2014
    Hey!

    Yes that was the problem.
    I guessed the problem was linked with the data being loaded in Ajax, but I am new to Datatables, using the 1.10 and the documentation is lacking many details in my opinion.
    In this case, it would have been useful for me if this was mentioned in the doc...

    Anyway thanks for the quick answer and for the great plugin! :)
This discussion has been closed.