How to use column().search()

How to use column().search()

postitiefpostitief Posts: 22Questions: 9Answers: 0

Hello,

I'm using datatables in my Laravel application. I'm using this with server-side processing. Now I want to add a filter on a specific columns. If I look at the server-side manual (https://www.datatables.net/manual/server-side) I can sent parameters like columns[i][search][value]. But how am I able to fill this search value?

I tried something like this:
Javascript:

var table = $('#tanktransacties').DataTable({
                        "processing": true,
                        "serverSide": true,
                        "ajax": "/tankoverzicht/data",
                        "searching": false
});

$('#my_custom_search').on( 'keyup', function () {
                        table
                                .columns( 4 )
                                .search( this.value )
                                .draw();
});

This redraws the table, but does not set the columns[4][search][value].

How do I need to call this column search..?

This question has an accepted answers - jump to answer

Answers

  • postitiefpostitief Posts: 22Questions: 9Answers: 0

    Aaargg.. I needed to set searching to true!

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    Yup - if you disable searching, searching is, erm, disabled ;-)

    If you want to remove the main search input, remove the f option from dom.

    Allan

This discussion has been closed.