DAL SQLFORM.grid sort error

35 views
Skip to first unread message

Dmitri Ermolaev

unread,
Sep 14, 2015, 9:10:12 AM9/14/15
to web2py-users
DAL error
    h = CAT(
        SQLFORM.grid(db.gifts,
            deletable=False,
            editable=False,
            details=False,
            selectable=None,
            create=False,
            csv=False,
            ),


error 

<type 'exceptions.AttributeError'>



2467.
2468.
2469.
2470.
2471.
2472.

2473.
2474.
2475.
2476.

order = request.vars.order or ''
if sortable:
if order and not order == 'None':
otablename, ofieldname = order.split('~')[-1].split('.', 1)
sort_field = db[otablename][ofieldname]

exception = sort_field.type in ('date', 'datetime', 'time')
if exception:
orderby = (order[:1] == '~' and sort_field) or ~sort_field
else:
Variables
sort_fieldundefined
db<DAL uri="mysql:******@localhost..">
otablename'%7Egifts'
ofieldname'id'

Anthony

unread,
Sep 14, 2015, 10:03:51 AM9/14/15
to web2py-users
%7E is the encoding for the "~", which indicates reverse ordering. For some reason, it looks like that is not getting converted to a "~" when request.vars is created. Can you provide more details (show more code, provide the full traceback)? Which version of web2py, which browser, and what is the exact URL in the browser address bar?

Anthony

Michael Griffiths

unread,
Dec 9, 2016, 10:38:55 AM12/9/16
to web2py-users
I had this exact error.  Turned out I was setting request.vars['order'] to a value that conflicted with SQLFORM.grid.  If your using the 'order' variable name - change it to something else.
Reply all
Reply to author
Forward
0 new messages