DataTables hyperlink on all rows in a column

后端 未结 1 1979
逝去的感伤
逝去的感伤 2021-02-15 20:32

I am using DataTables to generate a table. There is a column containing order numbers.

For example: ...

I need every row in this column to have a hyperlink to

1条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-15 20:56

    Check this out: http://datatables.net/reference/option/columns.render

    You can add a column render callback when you specify columns definition.

    var columnsDef = [
    ...
    {
        "title": "Order No.",
        "render": function (data, type, row, meta) {
            return '' + data + '';
        }
    },
    ...
    ];
    
    $("#table").dataTable({
        ...
        "columns": columnsDef,
        ...
    });
    

    The data in that column will be changed to what the render function return.

    0 讨论(0)
提交回复
热议问题