individual col searching, not working.

individual col searching, not working.

wathertonwatherton Posts: 33Questions: 6Answers: 0

Ok,

need some help, cant see the wood through the trees on this one. I have the code working, but for some reason it is not filtering any of the results. It always return zero found, even though the search i do is there.

Any help would be appreciated.

var oTableData;
$(document).ready(function() {

var tdata;

$('#filterrow').hide();

$.ajax({
    type: "POST",
    url: "DataTable.aspx/GetData",
    data: "{}",
    dataType: "json",
    contentType: "application/json; charset=utf-8",
    success: function(result) {

        tdata = jQuery.parseJSON(result.d);

        oTableData = $("#tblDataTable").DataTable({
            data: tdata,
            responsive: true,
            dom: '<"top"Tfl><"clear">rt<"bottom"ip><"clear">',
            tableTools: {
                "sSwfPath": "/Content/DataTables-1.10.4/extensions/TableTools/swf/copy_csv_xls.swf",
                "aButtons": [
                    {
                        "sExtends": "copy",
                        "sButtonText": "Copy to clipboard",
                        "oSelectorOpts": { page: 'current' }
                    },
                    {
                        "sExtends": "csv",
                        "sButtonText": "Export to CSV",
                        "oSelectorOpts": { page: 'current' }
                    }
                ]
            }
            columns: [
                { data: 'Amount' },
                { data: 'MessageDate' },
                { data: 'Status' },
                { data: 'MessageId' }
            ]
        });

        var table = oTableData;
        table.columns().eq(0).each(function (colIdx) {
            $('input', table.column(colIdx).footer()).on('keyup change', function () {
                table
                    .column(colIdx)
                    .search(this.value)
                    .draw();
            });
        });
    }
});

});

I've also listed it on stackoverflow.

http://stackoverflow.com/questions/27319387/individual-col-searching-datatables

This discussion has been closed.