datatables hyperlink in td

$(document).ready(function () {
    $('#example').DataTable({
        "ajax": "http://127.0.0.1:8080/api/resources/",
        "columns": [
            {
                "data": "name",
                "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
                    $(nTd).html("<a href='http://127.0.0.1:8080/media/" + oData.name + "'>" + oData.name + "</a>");
                }
            },
            {"data": "brief"}
        ]

    });

});

posted @ 2018-09-07 20:07  idlewith  阅读(132)  评论(0编辑  收藏  举报