You can pass constraints on to linked tables using the following:
constraints={'contact':query,'yourtablename':yourconstraintquery}
SQLFORM.smartgrid(db.contact, fields=fields, constraints=constraints,
orderby=orderby, create=create, details=details, editable=editable,deletable
=deletable,
csv=False, search_widget=searchForms, paginate=15, maxtextlength=45)
You can also provide custom search forms for each downstream linked table
by passing a dict of the search form methods.
Once you really get in to the smartgrid, it isn't hard at all to deviate
from what comes out of the box.
-Jim
On Monday, October 1, 2012 9:08:40 AM UTC-5, Dominic Cioccarelli wrote:
> Hi all,
>
> ok, making more and more progress with smartgrid but still a couple of
> gaps.
>
> I have a model structure which, simplifying things somewhat, has a
> hierarchy A-.>B->C.
>
> samrtgrid allows me to set up the model structure and then simply define a
> controller and view for A: I get the CRUD web pages for B & C for free.
>
> My question is, what happens if I need to customise one of these
> automatically generated sub-pages. e.g., after navigating from A to B to C
> I will have a list of all C's that belong to the B I chose (y) from A (x).
> The URI will be:
>
> http://mysite/app/A/index/A/B.a_id/x/C.b_id/y
>
> So now I'm 2 levels down and I only defined a single controller at the top
> level. I need to implement a check box which constrains the C's that I'm
> seeing on this page.
>
> I'm very impressed by how much you can do with so little in smartgrid but
> a but frustrated when you need to deviate from what you get for "free".
>
> Thanks in advance.
>
> Ciao,
> Dominic.
>
>
--