I figured out a way with grid (recursively loads all the children "stack")
ps.: probably there is a better way to find out which tables are 
referencing you

    children_queries= {
     db.grandparent: lambda row: db.parent.parent==row.id,
     db.parent: lambda row: db.child.parent==row.id,
     db.child: lambda row: None,
    }

    backrefs = {
     db.grandparent: db.parent,
     db.parent: db.child,
     db.child:  None,     
    }
    
    def get_children_grid(table, row):
        query = children_queries[table](row)
        link_body = lambda row: get_children_grid(backrefs[table], row) if 
query else None
        return SQLFORM 
<https://jurgis.pythonanywhere.com/examples/global/vars/SQLFORM>.grid(query, 
links=[dict(header='children', body=link_body)]) if query else None
   
    SQLFORM 
<https://jurgis.pythonanywhere.com/examples/global/vars/SQLFORM>.grid(db.grandparent,
 links=[dict(header='children', body=lambda row: 
get_children_grid(db.grandparent, row))]) if query else None


but then I'd like to get rid of all the headers/export options...


2013 m. balandis 8 d., pirmadienis 17:21:35 UTC+3, Jurgis Pralgauskis rašė:
>
> Hi, 
>
> can this be accomplished with some grid?
> http://i.stack.imgur.com/Eirfv.png
> [image: http://i.stack.imgur.com/Eirfv.png]
>
> I thougth over a bit: 
> a) with grid - I can construct sequence of joins-- just the parents 
> (Author/Book/Story..) would be repeated for each line (and then might be 
> hidden via js)
>
> b) with smartgrid - maybe possible to hook, that it loads children in the 
> TD (where the link to children is)
>    (then would be nice to force loading it without clicking -- but)
>
> probably links parameter could be workaround?
>
>
>

-- 

--- 
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to