Have you taken a look at the field_id parameter for grid? 

field_id must be the field of the table to be used as ID, for example 
> db.mytable.id.


SQLFORM.grid(..., field_id = db.item.id,...) might be what you're looking 
for if I'm understanding your correctly.

http://web2py.com/books/default/chapter/29/07#SQLFORM.grid-and-SQLFORM.smartgrid
 

On Wednesday, February 27, 2013 4:51:21 AM UTC-6, sander.vi...@gmail.com 
wrote:
>
> Good day,
>
> We're using web2py and loving it, but we ran into an issue with the 
> sqlform.grid. Quick sketch of my situation:
>
> A relatively complex query is build up according to filter settings. This 
> recently included joins to other tables and not just one to many, but 
> many-to-many. Ie there is a table containing items and a table containing 
> groups and a table that links these two together, let's call it 
> 'group_item'.
>
> You can imagine I want to show only items belonging to a certain group(s) 
> - if that particular filter is activated.
>
> It works, meaning they show up in the grid overview, but the links to the 
> 'view' and 'edit' pages are now defunct (they refer to the linking table 
> 'group_item' instead of 'item'). The result of the query is a nested set, 
> items, groups and group_items, so the grid doesn't know which one I 
> actually want to view/edit. I can think of quite some ways to fix this in 
> an ugly way (build view/edit links myself or even worse I could change them 
> after loading with JS ;) )
>
> I was hoping there is some known way of dealing with this situation 
> (having a query that gives a nested result), perhaps the grid can somehow 
> be informed it should only use the 'item' results?
>
> Thanks!
>

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to