I'm trying to use smartgrid in a app, and could be sucessful in most parts.
But there are some things stopping, so I'm here asking for help

1. The old way of use lambda in represent was

represent = lambda field: get_atividade(field)

and now, in some parts of smartgrid and book V4, look as:

represent = lambda field,row : get_atividade(field)

the last works with the grid, but not in form to view and crud.

I solved this using a if statement, but I think that could be implemented
one way to do use represent without setting it every time.



2. The linked_tables settings works for grid, but not for form (view and
edit) . I looked at code (gluon/sqlhtml.py#..smartgrid)
, and found this:

                if linked_tables is None or referee in linked_tables:
                    field.represent = lambda
id,r=None,referee=referee,rep=field.represent: A(callable(rep) and rep(id)
or
id,_class=trap_class(),_href=URL(args=request.args[:nargs]+['view',referee,id],
user_signature=user_signature))

i think referee is a way to know if is viewing or edit form, but it always
show all the linked_tables, so linked_tables settings is uselless.  I think
it could remove the second part of if to properly use the settings way.

3. I need to show only some registers in a grid. But whiles the docs talk
about the constraints settings, i cant find a example of query to make it
work. A workaround was use the keywords (as in user made query, but it has
the disavantage of show the query in the search field.
Could someone provide a example of using constraints?


-- 
Atenciosamente


Alexandre Andrade
Hipercenter.com Classificados Gratuitos

Reply via email to