数据表服务器端处理(按需加载)

时间:2017-07-01 11:57:21

标签: javascript jquery asp.net-mvc model-view-controller

我正在尝试按需加载进行服务器端处理,我正在使用mvc来开发我的应用程序

以下是我在datatables js class上的代码,

var initTrackingTable = function () {
    var table = $('#tableCategoryList');
    var daterange = $("#daterangepicker").val();

    val_CategoryName = $("#SearchTextBox").val();
    //val_Daterange = $("#trackingForm").find("[name='daterangepicker']").val();

    settingsInitEmpty = {
        ajax: ({
            url: "/Product/LoadCategoryData?category=" + val_CategoryName,
            type: "POST",
            datatype: "json"
        }),
        // ### FOR SERVERSIDE LODING
        processing: true,
        serverSide: true,
        filter: false,
        orderMulti: false,
        columns: [
                   { data: "category_id", name: "category_id", autoWidth: true },
                   { data: "category_name", name: "category_name", autoWidth: true, render: function (data, type, row) { return '<span class=""><a href="/Product/EditCategory?id=' + data + '" class="btnTrackingDetails" target="_blank">' + data + '</a></span>' } },
                   { data: "sort_order", name: "sort_order", autoWidth: true },
        ],
        initComplete: function (settings, json) {
            $("#tableCategoryList").parent().addClass("tableTransactionGridWrapper")
        }
    };
    categoryTable = table.DataTable(settingsInitEmpty);

}

在category_name那里,我希望放置超链接,但是我打算将category_id作为查询字符串参数的超链接,以便我能够编辑类别。请问这是可以实现的吗?如果是,代码假设如何?

0 个答案:

没有答案