You mean the onclick: function() ?

El martes, 28 de marzo de 2017, 10:09:04 (UTC-3), Marlysson Silva escribió:
>
> Have you tried the ajax function() from web2py ?
>
> It use the callback function on controller and the data( id by example ) , 
> and the callback receive this data and process them ( make search and 
> delete it ) .
>
> Em segunda-feira, 27 de março de 2017 20:49:59 UTC-3, Winter Kryz escreveu:
>>
>> Hello Everybody,
>>
>> I hope someone can help me, I have a table full of records from a data 
>> base, each row has a delete button so what I want to do is to show a 
>> "Yes/No" Javascript popup to confirm the delete action.
>>
>> So far what I did is:
>>
>>  *** controller ***
>> def Person():
>>     person = db(db.Person.id>0).select()
>>     class Virtual(object):
>>         def button(self):
>>           XML(A(SPAN(_class='glyphicon 
>> glyphicon-remove'),_id="delete",_onclick='myFunction()',_class='btn 
>> btn-default fechar Jview btn-xs')),_class='btn-group btn-group-justified 
>> JpositionA')
>>             return bts
>>     person.setvirtualfields(campos_virtual = Virtual())
>>     return dict(formListar=person)
>>
>> *** View ***
>> <script>
>> function myFunction() {
>>     $('#myModal').modal('show');
>>     return false;
>> };
>>
>>  function myFunctiondelete() {
>>  };
>> </script>
>>
>>     <table id="tablaGenerica" class="tablaC table-striped hover 
>> cell-border" cellspacing="0" width="100%" >
>> <thead>
>>     <tr>
>>         <th>Name</th>
>>         <th>Surname</th>
>>         <th></th>
>>     </tr>
>>     <tbody>
>>         {{for person in formListar:}}
>>             <tr>
>>                 <td>{{=person.Person.name}}</td>
>>                 <td>{{=person.Person.surname}}</td>
>>                 <td 
>> class="options">{{=person.campos_virtual.buttons}}</td>
>>             </tr>
>>     </tbody>
>>        {{pass}}
>> </thead>
>> </table>
>> <div id="myModal" class="modal fade">
>>   <div class="modal-dialog" role="document">
>>     <div class="modal-content">
>>       <div class="modal-header">
>>        <h4 class="modal-title">Confirmation </h4>
>>       </div>
>>       <div class="modal-body">
>>        <p>
>>           Are you sure you want to delete?
>>           </p>
>>       </div>
>>       <div class="modal-footer">
>>           <div class="col-md-6 col-md-offset-3 ">
>>         <button type="button" id="cancel" class="botones btn 
>> btn-secondary" data-dismiss="modal">No</button>
>>         <button type="button" id="warning" class="botones btn 
>> btn-warning" onclick="myFunctiondelete()";>Yes<span class="glyphicon 
>> glyphicon-remove"></span> </button>
>>          </div>
>>
>> Basically, everytime I click on the button I defined on the controller it 
>> calls a function "myFunction()" which shows a Javascript modal with the 
>> Yes/No options. When I click on "Yes" it doesn't do anything because I 
>> don't know how to pass the id of that particular record.
>>
>> Anyone knows an easier method or how can I pass the id of that particular 
>> record?
>>
>> Thanks
>>
>

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