I too have come across this same problem - good to see a solution (Now to 
try it for my scenario)

Thanks Kyle !!

-Mandar

On Thursday, February 28, 2013 9:54:35 PM UTC+5:30, [email protected] 
wrote:
>
> Awesome, that's it, field_id.
>
> To prove our loyalty and to please the many python and web-development 
> related deities we wear these t-shirts when working with web2py
>
> :)
>
> Op woensdag 27 februari 2013 21:17:50 UTC+1 schreef Kyle Flanagan het 
> volgende:
>>
>> 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, 
>> [email protected]:
>>>
>>> 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to