我有一个数据表,我想添加一个action(static)列,例如:Edit Row,Delete Row和... 此列应在表格的所有行中重复。 桌子最像这样:
<table>
<thead>
<tr>First Name</tr>
<tr>Last Name</tr>
<tr>Email</tr>
<tr>Actions</tr>
</thead>
<tbody>
<tr>John</tr>
<tr>Doe</tr>
<tr>johndoe@gmail.com</tr>
<tr>
/* STATIC SECTION IN ALL ROWS */
<a href="/mysite.com/user/edit/257">Edit</a>
<button data-user-id="257">Delete</button>
</tr>
</tbody>
</table>
我的数据表脚本代码是:
$.ajax({
url: 'https://api.mysite.com/api/',
dataType: "json",
type: "GET",
data: {"request": "list_users"},
success: function(result){
$('#myTable').dataTable({
data: result
});
}
});
//Api Json response is:
0:{
{0: "John", 1: "Doe", 2: "johndoe@gmail.com"}
},
1:{
{0: "Alis", 1: "Crouz", 2: "aliscrouz@gmail.com"}
}