I am using v2.4.2 on win7, tried both chrome and firefox, same issue, I
have to do a refresh to see Active field checked/unchecked
On Thursday, March 7, 2013 4:54:45 PM UTC-5, Massimo Di Pierro wrote:
>
> It should update it. it does for me.
>
> On Thursday, 7 March 2013 15:43:08 UTC-6, wwwgong wrote:
>>
>> Thanks for the tip,
>> I noticed that the checkbox is not updated after clicking on/off button.
>> how to make active field refresh automatically
>>
>>
>> On Wednesday, March 6, 2013 9:09:41 PM UTC-5, Massimo Di Pierro wrote:
>>>
>>> Do you know you can do this?
>>>
>>>
>>> db.define_table('thing',Field('name'),Field('active','boolean',default=False))
>>>
>>> @auth.requires_login()
>>> def index():
>>> grid = SQLFORM.grid(db.thing,
>>> inks=[lambda row: A('on' if row.active else 'off',
>>> _class='btn', _id='t%i'%row.id,
>>> target='t%i'%row.id,
>>> callback=URL('activate',args=row.id))])
>>> return dict(grid=grid)
>>>
>>> @auth.requires_login()
>>> def activate():
>>> if request.env.request_method=='POST':
>>> thing = db.thing(request.args(0,cast=int))
>>> thing.update_record(active=not thing.active)
>>> return 'on' if thing.active else 'off'
>>>
>>> It makes Ajax buttons which toggle "on/off" the value of thing.active
>>> field for each row.
>>>
>>>
--
---
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.