Multi column searching not working on runtime created

Multi column searching not working on runtime created

serhattopkayaserhattopkaya Posts: 1Questions: 0Answers: 0

Hi,
I need to create table on runtime. I created table after a ajax call and if i apply multi column filtering its not working. The sample code here. Any idea? Thanks in advance.

for (var i = 0; i < columns.length; i++) {
    $("#idTableAnalysis tr").append("<td>" + columns[i] + "</td>");
    gridColumns.push(obj);
}

$('#idTableAnalysis').dataTable({
        "bServerSide": true,
        "sAjaxSource": ajaxSource,
        "bProcessing": true,
        "columns":gridColumns
});


$('#idTableAnalysis tfoot th').each(function () {
    var title = $('#idTableAnalysis thead th').eq($(this).index()).text();
    alert(title);
    $(this).html('<input type="text" placeholder="Search ' + title + '" />');
});

// DataTable
var table = $('#idTableAnalysis').DataTable();

// Apply the search
table.columns().every(function () {
    var that = this;

    $('input', this.footer()).on('keyup change', function () {
        that
            .search(this.value)
            .draw();
    });
});
This discussion has been closed.