且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在引导数据表中创建新行

更新时间:2023-12-01 20:53:40

您应该添加实际数据,而不是<td></td>元素.例如,

You should add actual data and not <td></td> elements. For example,

var t = $('#tblevent').DataTable();

t.row.add({
    "SERVICETEXT": "Service Name",
    "ITEMNAME": "Item name",
    "USGDATE": "1995-12-25",
    "QUANTITY": "1",
    "UNITTEXT": "2",
    "RATE": "3",
    "AMOUNT": "4",
    "SID": "5"
}).draw();

要呈现单元格内容并在单元格中显示<input>元素,请对这些列使用mRender回调,类似于对SID列使用它的方式.

To render cell content and display <input> elements in the cell, use mRender callback for those columns similarly to how you use it for SID column.