smartgrid sort with three one to many tables
def uvidomlen_all():
table=db.operacia
gqu = lambda tnm : (tnm.id>0) if auth.user.is_admin else
(tnm.created_by == me)
oqu = lambda tnm : ~db[tnm].id
constraints = {'operacia':gqu(db.operacia), 'os1doc':gqu(db.os1doc),
'os2doc':gqu(db.os2doc), 'os3doc':gqu(db.os3doc)}
orderby = {'operacia':oqu('operacia'), 'os1doc':oqu('os1doc'),
'os2doc':oqu('os2doc'), 'os3doc':oqu('os3doc')}
return dict(grid=SQLFORM.smartgrid(db.operacia,
deletable = False, #constraints = dict(povidomlen=query),
editable = auth.user.is_admin,
orderby= orderby,
constraints= constraints,
linked_tables= ['os1doc','os2doc','os3doc'] ,
buttons_placement = 'left',
user_signature=False,searchable=True, create=False,
csv=False,showbuttontext=False, ))
четверг, 18 июня 2020 г., 18:38:39 UTC+3 пользователь rāma написал:
>
> Hi all,
>
> How to sort a smartgrid with your own custom sorted id list?
>
> Say I have a id list after executing the query and I have a sorting
> functions that returns a sorted id list, how would I make smartgrid to
> commit to the ordering instead of sorting by ids by default?
>
> Thanks,
> rama
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/100b80be-4842-4bab-96c0-c00df0d75349o%40googlegroups.com.