you didn't ask for that - removing the clicked row - but you're lucky 
anyway.
add a delete='tr' to the A helper.

http://web2py.com/books/default/chapter/29/05?search=callback#Built-in-helpers

On Friday, March 1, 2013 4:59:39 PM UTC+1, Christian Espinoza wrote:
>
> Wow, Thanks Niphlod!,this code worked like a charm!
>
> Additionally how can I append this code: 
>
> jQuery(this).closest('tr').remove();
>
> to the callback?
>
> Thanks again for your time!
> Christian.
>
> El viernes, 1 de marzo de 2013 12:31:54 UTC-3, Niphlod escribió:
>>
>> disclaimer: not tested: in a controller, prepare a function
>>
>> def check_to_true():
>>     if not request.args(0):
>>         return ''
>>     db_events.alerts(request.args(0)).update_record(checked=1)
>>
>> and then pass links in the grid as
>> links = [
>>     dict(header='check the rec', 
>>            body=lambda row : A('check', _class='btn', _href='#', callback
>> =URL('check_to_true', args=row.id))
>>           )]
>>
>>
>> This should create a clickable button that calls your function and sets 
>> the checked to true without leaving the page holding the grid (ajax). 
>> If you need to refresh the values also on the grid page, than a full 
>> refresh of the page is needed, so remove the callback argument, use that 
>> url in the href and put a redirect(URL('function_showing_the_grid')) at the 
>> end of the "check_to_true" function.
>>
>> On Friday, March 1, 2013 4:08:05 PM UTC+1, Christian Espinoza wrote:
>>>
>>> Hi guys, I want to add a action button(like delete,edit, view, i/e) at 
>>> the grid, something to change a value from the record indicated at the line,
>>> this is my table:
>>>
>>> db_events.define_table('alerts',
>>>             Field('type', length=20, label='Clase' ),
>>>             Field('rule', label='Regla'),
>>>             Field('value', length=30, label='Valor'),
>>>             Field('detail', label='Detalle'),
>>>             Field('coords', length=20, label='Coordenadas'),
>>>             Field('checked', 'integer', label='Chequeada', default=0 ),# 
>>> 1 to checked
>>>             Field('created_on', 'datetime', label='Recibida', default=
>>> request.now)
>>>             )
>>>
>>> The idea is have a button to check the alert, I mean: will be put a 1 at 
>>> "checked" field of the record when the button will be clicked
>>>
>>> Thanks for your time and support!
>>> Christian.
>>>
>>>

-- 

--- 
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/groups/opt_out.


Reply via email to