SQLFORM.smartgrid() ui does not accept elements customization through dict() (SQLFORM.grid does)

48 views
Skip to first unread message

Luciano Laporta Podazza

unread,
Oct 12, 2016, 11:31:51 AM10/12/16
to web2py-users
Hello!

I tried to apply some css classes to smartgrid elements with no success. It seems that smartgrid ignores ui argument but grid does

my controller:

def index():
   
"""
    example action using the internationalization operator T and flash
    rendered by views/default/index.html or views/generic.html


    if you need a simple wiki simply replace the two lines below with:
    return auth.wiki()
    """

    form
= SQLFORM.smartgrid(db.citizen, user_signature=False,
            ui
= dict(widget='',
               header
='',
               content
='',
               
default='',
               cornerall
='',
               cornertop
='',
               cornerbottom
='',
               button
='btn btn-default button',
               buttontext
='buttontext button',
               buttonadd
='glyphicon glyphicon-plus space-after btn-primary',
               buttonback
='glyphicon glyphicon-arrow-left space-after',
               buttonexport
='glyphicon glyphicon-download space-after',
               buttondelete
='glyphicon glyphicon-trash space-after',
               buttonedit
='glyphicon glyphicon-pencil space-after',
               buttontable
='glyphicon glyphicon-arrow-right space-after',
               buttonview
='glyphicon glyphicon-arrow-zoom-in space-after'))
   
return dict(form=form)


If I change some css class names, smartgrid ignores them and uses the default ones. But if I use grid instead of smartgrid, css changes takes effect.

How can I use ui argument on smartgrid too?. Thanks in advance!

P.S.: I'm using web2py 2.14.6-stable+timestamp.2016.05.10.00.21.47

Anthony

unread,
Oct 12, 2016, 12:44:43 PM10/12/16
to web2py-users
It's a bug: https://github.com/web2py/web2py/issues/1351. Unfortunately, I think the only workaround is to create a dictionary with a key for each table that might be linked to your parent table:

ui = dict(widget='', ...)
tables
= ['citizen', 'country', ...]
grid
= SQLFORM.smartgrid(db.citizen, ui={table: ui for table in tables})

Anthony
Reply all
Reply to author
Forward
0 new messages