Я пытаюсь добавить кнопки «Редактировать» и «Удалить» в каждой строке таблицы данных.
Когда я нажимаю «изменить», он вызывает функцию контроллера и должен передать идентификатор этой строки в качестве аргумента.
У меня проблемы с этим.
Есть предложения?
Мой контроллер
`
def usuarioUpdate():
return dict(formUsuarioUpdate=crud.update(db.Users,request.args(0)))`
Мой взгляд
<script>
var tabla;
$(document).ready(function(){
tabla= $('#tablaGenerica').DataTable({
"data": {{=formListar}},
"scrollX": false,
"dom": 'lrtip',
"searching": true,
"sRowSelect": 'single',
"language": {
"url": "{{=URL('static','js/tradutorTable.json')}}",
},
"columns": [
{
"class":"details-control",
"orderable":false,
"data":null,
"defaultContent": ""
},
{ data: 'users.first_name' },
{ data: 'users.last_name' },
{ data: 'users.email' },
{ data: 'users.username' },
{
"orderable":false,
"data":null,
"defaultContent": "<div class='btn-group btn-group-justified JpositionA'><a class='btn btn-success Jview btn-xs' href='{{=URL('Herramientas','usuarioUpdate',args=["users.id"])}}'><span class='glyphicon glyphicon-pencil'></span></a><a class='btn btn-warning Jview btn-xs' href=><span class='glyphicon glyphicon-remove'></span></a></div>",
},
]
});
</script>
<table id="tablaGenerica" class="tablaC table-striped hover cell-border" cellspacing="0" width="100%" >
<thead>
<tr>
<th></th>
<th>Nombre</th>
<th>Apellido</th>
<th>Correo Electrónico</th>
<th>Nombre de Usuario</th>
<th></th>
</tr>
</thead>
</table>