我是数据表的新手(http://datatables.net/)。我需要根据我的 ajax 调用结果的计算添加列。我尝试了以下方法,但得到错误“数据表请求来自行的数据源的未知参数”。这是这种要求的正确方法吗?我非常感谢您在这方面的帮助。这是表结构的外观:
<table id="result" class="show_hide">
    <thead>
        <tr>
            <th>Time1</th>
            <th>Time2</th>
            <th>Elapsed Time</th>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>
这是我的 ajax 调用的示例输出:
[{
    "time1": 12345,
    "time2": 56789
},  
{
        "time1": 2000,
        "time2": 3000
}]
这就是我正在尝试使用数据表
$('#result').dataTable({
        "sAjaxSource": "http://" + hostname + ":" + port + api,
        "sAjaxDataProp": "",
        "iDisplayLength": 25,
        "bRetrieve": true,
        "sPaginationType": "full_numbers",
        "aoColumns": [{
            "mDataProp": "time1"
        },
        {
            "mDataProp": "time2"
        },
       {
            "mRender": function(data, type, row) {
                return (row.time2 - row.time1);
            },
            "mDataProp": null
       }
    ]
    });