You could create a custom formstyle function and then pass it to the grid 
via the "formargs" argument or set response.formstyle.

Anthony

On Thursday, May 25, 2017 at 4:50:58 AM UTC-4, icodk wrote:
>
> Background
> My model has a table with many fields (62). When using smartgrid to edit 
> or add a record, all fields are shown in a long vertical list in the same 
> order as defined in the model. So log so good.
> This can be overwhelming to user that might need to see some of the fields 
> very often and some others less frequently.
> One way to solve this could be to show the fields in separate tabs that 
> groups the fields according to some designation. Here is an example
> Model:
>
> db.define_table('person',
>                 Field('first_name',tab='General', label=T('First name'), 
> default='',length=50),
>
>                 Field('last_name',tab='General', label=T('Last name'), 
> default='',length=50),
>
>                Field('phone',tab='Advance',label=T('phone'), default=''),
>
>                 Field('visits',tab='Statistics','integer' label=T('Visits'), 
> default=0))
>
>
> In the above model I added an imaginary tab property (which will cause en 
> error in real application)  to group  fields with the same tab property 
> under the same tab in a detail smartgrid form.
> To solve the order of the tabs, the call to the smartgrid will include a 
> 'tab' property which will be a list with tabs.
>
> Another more flexible solution  could be to add a 'tab ' property to 
>  smartgrid which will be a dictionary with tab names as keys and a lists of 
>  field names as values. This will allow also to order the fields on each 
> tab and will not require any change to the existing define_table structure.
>
> Example:
> tabs={'General':['first_name','last_name'],'Advance':['phone'],
> 'Statistics':['visits']}
>
> I have this strange filling that this is already possible, may be 
> something to do with formstyle.
> Any help will be appreciated
>

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