Getting error "TypeError: i is undefined" when setting global search on ServerSided Datatable

Getting error "TypeError: i is undefined" when setting global search on ServerSided Datatable

zemetalzemetal Posts: 5Questions: 1Answers: 0

Hi all,

I am kinda desperate trying to find a solution for this; I had a no-serversided datatables working, and an input working as a global search using fnFilter.
Now that I needed to change the way it works due to high volume of db entries, I have to implement another global search on the table, since fnFilter won't work anymore (I think).

The problem is, whatever approach I take to do so, I always get "TypeError: i is undefined" on the jquery.datatables.js

I tried to do it using oSearch:

"oSearch": {"sSearch": "Initial search"}

and after seeing it is a legacy feature, searched some more and found this:

var table = $( '#mytable' ).DataTable();
table.search( 'initial search value' ).draw();

Tweaked it up a bit to use the previous search box and got this:

$('#input_search_datatable').keyup(function() {
    $('#example').DataTable().search($(this).val()).draw();
});

On the first method, the error appears as soon as the page loads, on the other one it triggers each time I press a key (due to the keyup event).
I can't seem to find the solution to this, can anyone help me please?

Best regards,
José

Answers

This discussion has been closed.