如何在datatables.js中创建一个链接列?

时间:2015-06-12 23:09:47

标签: javascript jquery-datatables

我试图弄清楚如何在dataTables.js中创建一个链接。我大部分都在工作,但无法显示链接。

var dataSet = [
 ['PR12345','Test O Rama','5/7/2015','Open'],
 ['PRJ_AR09','Project Name','5/8/2015','New Request'],
 ['PRJ_AR18','Test Project','5/10/2015','New Request'],
 ['PR092134','Test Project 1','5/10/2015','Open'],
 ['PRO012333','Test Project 2','5/10/2015','Open'],
 ['PRO83880','Test Project 3','5/10/2015','Open']
];
$(function() {
    $('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="workQueueTable"></table>' );
    $('#workQueueTable').DataTable({
    "data": dataSet,
    "columns": [
        { "title": "Project ID", "sWidth": "10%", "fnRender": function(data) {
                return "<a href='" + data + "'></a>";
                }  },
        { "title": "Project Name" },
        { "title": "Date Requested", "sWidth": "10%" },
        { "title": "Status", "sWidth": "15%" }
    ]
    });
});

Example Code

似乎无法显示链接?

1 个答案:

答案 0 :(得分:0)

好的,我找到了答案。 fnRender已被折旧,因此您必须立即使用mRender。

令人惊讶的是,当您使用正确的语法时,一切都会更好。