yes
something like that ;)

thanks Massimo


On Friday, July 17, 2015 at 3:13:56 AM UTC-5, Massimo Di Pierro wrote:
>
> Something like this?
>
> db.define_table('item', Field('name'),Field('value','double'))
>
> def index():
>       c = lambda id: "c%s" % id
>       table = TABLE()
>       item = db(db.item).select():
>       for item in items:
>              table.append(TR(LABEL(item.name),INPUT(_name=c(item.id
> ),value=item.value)))
>       form = FORM(table)
>       if form.process().accepted:
>              for item in items:
>                      newvalue = form.vars[c[item.id]]
>                      if newvalue != str(item.value):
>                            item.update_record(value=newvalue)
>              response.flash = 'saved'
>       return dict(form=form)
>                            
>
>
> On Thursday, 16 July 2015 17:30:23 UTC-5, JorgeH wrote:
>>
>> Hello
>>
>> I need to generate a grid like
>>
>>
>> <https://lh3.googleusercontent.com/-Y_uOwCxGkY0/Vaguw-0K1DI/AAAAAAAAAJM/4dkpl2IQORc/s1600/Captura.PNG>
>>
>>
>>
>>
>> table definition is:
>>
>> db.define_table ('produccion',
>>                 Field ('proyecto', 'reference proyectos'),
>>                 Field ('month', 'date'),
>>                 Field ('ton_presup', label='Budgeted Tons'),
>>                 Field ('ton_adic', label='Additional Tons'),
>>       
>>                 )
>>
>>
>> I have currently generated the form in the view only, iterating rows, but 
>> want to do it from the controller using form factory for validation 
>> purposes.
>>
>>
>>
>> the number of rows and starting month may vary.
>>
>> How can I use a list item as a variable name, and by the way is this the 
>> best approach?
>>
>>
>>
>>
>> Any hints?
>>
>> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to