>
> here is the minimal app, and I did reproduce the problem and narrowed 
> where it broke. 
> In view_invoices() action, it checks if customer id args is provided, if 
> so it will take it in for invoice_query = db.invoice.customer==customer_id, 
> if not invoice_query = db.invoice.customer != None (pls let me know if 
> there is a better way to define the query for selecting all invoice). Below 
> code works when I specify the customer id in the URL eg. 
> http://localhost:8000/tests/default/view_invoices/2, now when i click on 
> the linked_tables 'Items', it will redirect to 
> http://localhost:8000/tests/default/view_invoices/2/invoice/item.invoice/1
> . 
> Now, if I don't specify the customer id in URL
>

That's the problem. In some cases you don't specify the customer ID as 
request.args[0], and yet in all cases you tell smartgrid that you are in 
fact using request.args[0] (by specifying args=request.args[:1]). You must 
either always specify something as the first URL arg in your links, or 
conditionally set the "args" argument of the smartgrid.
 

> Another question related to it is - how does web2py construct the URL for 
> redirect when linked_tables is used? eg. 
> http://localhost:8000/tests/default/view_invoices/2/invoice/item.invoice/1. 
> The blue part is what I typed in, the red is provided by the linked_tables.
>

The grid generates a number of different links and uses the URL args (after 
any you explicitly specify) to determine what output to generate. For 
example, the above indicates you started viewing records in the invoice 
table and then clicked a link pointing to records in the item table with a 
db.item.invoice value of 1 (i.e., items linked to invoice 1).

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to