Search stopped working when using javascript data source

Search stopped working when using javascript data source

gizmojogizmojo Posts: 2Questions: 1Answers: 0
edited May 2021 in DataTables 1.10

https://jsfiddle.net/pad5xgn7/2/

My datatable has grown so big that the initial load of html causes the browse to crash on old mobile phones. So I've moved to use javascript array as data and working really well.

Problem is that now the search has stopped working like it did before.

I have to hide the standard search so that I can change the location (jsfiddle is simplified for demo) otherwise when I called table.columns().search(this.value).draw() nothing happened.

$(document).ready(function() {
    let dataTable = $('#example').DataTable( {
        data: dataSet,
        columns: [
            { title: "Name" },
            { title: "Position" },
            { title: "Office" },
            { title: "Extn." },
            { title: "Start date" },
            { title: "Salary" }
        ]
    } );
    
    $('input[type=search]').on('keyup', function () {
      dataTable.columns().search(this.value).draw();
    })
} );

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.