我正在使用Ignited Datatables来查看活跃用户。我现在想要的是一个Action列,我可以禁用该用户。这是我的代码。
视图:
<script type="text/javascript">
$(document).ready(function() {
$('#users_table').dataTable({
"sScrollX": "100%",
"sScrollXInner": "100%",
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"bJQueryUI": true,
"bDeferRender": true,
"sAjaxSource": "<?php echo base_url(); ?>/users/get_active_users",
"sServerMethod": "POST",
"aoColumnDefs": [{
'bSortable': false,
'aTargets': [7]
}
]
});
});
</script>
<thead>
<tr>
<th class="width70 text-center">Username</th>
<th class="text-center">Full Name</th>
<th class="text-center">Office</th>
<th class="text-center">Position</th>
<th class="text-center">Email</th>
<th class="width60 text-center">Privilege</th>
<th class="width160 text-center">Date Registered</th>
<th class="width60 text-center">Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="7" class="dataTables_empty">Loading data from server</td>
</tr>
</tbody>
答案 0 :(得分:1)
使用点燃的数据表,您需要在数据表中添加操作列,如
$this->datatables->add_column('action', '<a href="user/disable/$1">Disable User</a>', id);