我是DataTables的新手。我想在每一行添加按钮进行编辑和删除(如下图)
我试过代码:
Test.cfm
UserIDNameUserNamePassowrdEmailIsActiveCommand
$(document).ready(function () {
var oTable = $('#myDataTable').dataTable({
// "bServerSide": true,
"sAjaxSource": "fetchUserData.cfm",
"bProcessing": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "mData": null },
{ "mData": "Name", "sTitle": "Name" , "sWidth": "20%"},
{ "mData": "UserName", "sTitle": "UserName", "sWidth": "20%" },
{ "mData": "Passowrd","sTitle": "Passowrd", "sWidth": "20%" },
{ "mData": "Email","sTitle": "Email" , "sWidth": "20%"},
{ "mData": "IsActive","sTitle": "IsActive" , "sWidth": "20%" },
{
"mData": null,
"bSortable": false,
"mRender": function (o) { return '' + 'Edit' + ''; }
}
]
});
});
fetchUserData.cfm
{
"aaData": [
[
"1",
"sameek",
"sam",
"sam",
"sameek@test.com",
"1",
""
],
[
"2",
"arun singh",
"arun",
"arun",
"arunsingh@test.com",
"0",
""
],
[
"9",
"s s",
"sam3",
"sam3",
"ss@s.com",
"0",
""
],
[
"10",
"sameek mishra",
"sam56",
"sam",
"same@s.com",
"0",
""
],
[
"11",
"narendra kumar",
"narendra",
"nav",
"sa@sa.com",
"1",
""
],
[
"12",
"test test",
"test",
"test",
"test2@test.com",
"1",
""
]
]
}
请帮帮我。
谢谢