Hello everybody,

I'm trying to add an "Edit" and "Delete" buttons on each row on a 
Datatable. When I click on "edit", it calls a controller function and needs 
to pass the id of that row as argument. I'm having issues doing it right. 
Any suggestions?


Thank you!


My controller


def usuarioUpdate():
       return dict(formUsuarioUpdate=crud.update(db.Users,request.args(0)))


My view


  <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>



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to