Not able to filter and sort columns using Json string from ajax source on ASPX page

Not able to filter and sort columns using Json string from ajax source on ASPX page

edsonmoreiraed2edsonmoreiraed2 Posts: 1Questions: 1Answers: 0

Here's my java script:

$(document).ready(function () {

var table;

$("thead input").keyup(function () {
    /* Filter on the column (the index) of this element */
    table.fnFilter(this.value, table.oApi._fnVisibleToColumnIndex(
                    table.fnSettings(), $("thead input").index(this)));
});

$("thead input").each(function (i) {
    this.initVal = this.value;
});

$("thead input").focus(function () {
    if (this.className == "search_init") {
        this.className = "";
        this.value = "";
    }
});

$("thead input").blur(function (i) {
    if (this.value == "") {
        this.className = "search_init";
        this.value = this.initVal;
    }
});



table = $('#gridTable').dataTable({
    "bPaginate": true,
    "bProcessing": true,
    "bServerSide": true,
    "bSortCellsTop": true,
    "sDom": 'T<"clear">Rlfrtip',
    "oLanguage": {
        "sSearch": "Pesquisar no resultado geral:"
    },
    "contentType": "application/json; charset=utf-8",
    "sAjaxSource": "CustomerService.asmx/GetList",
    "fnServerData": function (sSource, aoData, fnCallback) {
        $.ajax({
            "dataType": 'json',
            "contentType": "application/json; charset=utf-8",
            "type": "GET",
            "url": sSource,
            "data": aoData,
            "success":
            function (msg) {

                var json = jQuery.parseJSON(msg.d);
                fnCallback(json);
                $("#gridTable").show();
            }
        });
    }

});

});

This discussion has been closed.