Does columns(x).search(y) work for server side?

Does columns(x).search(y) work for server side?

theAnimalixtheAnimalix Posts: 35Questions: 12Answers: 2
edited April 2016 in Free community support

I'm using Responsive DataTables to render data sent from server side and displaying data and ordering works as expected, but I'm having problems with column filters that I have placed outside the table.

The problem is that after executing columns(x).search(y).draw() is executed POST request is sent as expected, but columns[x]['search']['value'] is always empty (on client and server side).

Here is my code:

    $('input.column-search').on('keyup', function (e) {
        if (e.keyCode == 13) {
            var columnIdx = parseInt($(this).attr('data-column'));
            var searchValue = $(this).val();
            console.log(columnIdx + ' = ' + searchValue);
            table.column(columnIdx).search(searchValue).draw();
        }

    });

Is this normal behavior? I would prefer using this way to get data for my filters instead of adding/altering payload via ajax.data.

This question has an accepted answers - jump to answer

Answers

  • theAnimalixtheAnimalix Posts: 35Questions: 12Answers: 2
    Answer ✓

    UPDATE: Sorry, my bad...found the mistake when I was thinking that I should also post my table init here.

    SOLUTION: I had 'searching' set to false since I thought it will disable table search (which wasn't displayed in my case) not column search, so setting it to true solved the problem.

  • allanallan Posts: 61,822Questions: 1Answers: 10,127 Site admin

    Thanks for posting back - good to hear you've got it working.

    Allan

This discussion has been closed.