How to do custom filtering with Datatables and server-side processing

前端 未结 5 1708
面向向阳花
面向向阳花 2021-02-02 17:30

I am using Datatables to display tabular data in my Web application, and have configured it to make use of server-side processing, i.e. query the server via AJAX for filtered da

5条回答
  •  -上瘾入骨i
    2021-02-02 18:03

    Dynamic parameter, This one is working for me, seems best solution

    t = $("#tbl_SearchCustomer").DataTable({
        processing: true,
        serverSide: true,
        info: true,
        ajax: {
            url: '../Data/SearchCustomer',
            data: function (data) {
                data.CustomerCategoryID = $("#CustomerCategoryID").val(); // dynamic parameter
                delete data.columns;
            }
        },
        deferRender: true,
        columns: [
            { "data": "FullName" },            
        ],       
        dom: 'lfrtip'
    });
    

提交回复
热议问题