2015-03-19 96 views

回答

1

mRender已更名爲columns.render。您可以在數據表1.10檢查出等價的名字你可能在1.9這裏使用了一切:的columns.render從文檔(http://datatables.net/reference/option/columns.renderhttp://www.datatables.net/upgrade/1.10-convert

例子:

以逗號分隔的列表:

$('#example').dataTable({ 
    "ajaxSource": "sources/deep.txt", 
    "columns": [ 
    { "data": "engine" }, 
    { "data": "browser" }, 
    { 
     "data": "platform", 
     "render": "[, ].name" 
    } 
    ] 
}); 

作爲一個功能:

$('#example').dataTable({ 
    "columnDefs": [ { 
    "targets": 0, 
    "data": "download_link", 
    "render": function (data, type, full, meta) { 
     return '<a href="'+data+'">Download</a>'; 
    } 
    } ] 
}); 

從@ VivienPipo的除了下面:

"render": function (data, type, full, meta) { 
    if (type == "display") { 
     return format_text_function(data); 
    } 
    return data; 
} 
+0

@VivienPipo已將您的代碼添加到答案中。 – 2015-03-19 12:25:45