On Jun 18, 2012, at 5:17 PM, Massimo Di Pierro wrote:
> The grid uses the request args to figure out which grid page to visualize. 
> There is only one set of request.args so if you have two grids each of them 
> thinks the args are for them. You may get some un-intuitive behavior like 
> navigating one grid affecting the other grid. The proper way to include two 
> grids it by using LOAD.

In my case the interaction is rather limited. If I switch pages in the 
secondary table, it loses whatever view/edit state the other table might be in, 
but it's not all that common a use case, and only admins use the page, so I can 
live with it.

But yeah, I can see the problem.

> 
> On Monday, 18 June 2012 15:02:31 UTC-5, Jonathan Lundell wrote:
> On Jun 18, 2012, at 3:06 PM, Massimo Di Pierro wrote:
>> You cannot have two grids in the same page.
> 
> I'm using two grids on a page. It seemed all I needed to do was specify 
> different formnames and it seemed to work. The second table is pretty much 
> read-only, but it does have a paging control, and that works. What should I 
> expect to go wrong?
> 
>> 
>> On Monday, 18 June 2012 06:09:24 UTC-5, rahulserver wrote:
>> I tried to use two sqlform.grid in a web2py form. It does work as intended 
>> except for the problem that when I try to edit on of the form's row, other 
>> form's row with same Id also appears to be edited. How should i stop it?
>> my controller:
>> def CommitmentBrowse_rep():
>>     rows=db(db.Commitments.Account==session.id).select()
>>     commtot=0
>>     compen=0
>>     comfull=0
>>     for row in rows:
>>         commtot=commtot+int(row.Amount)
>>         if row.pending:
>>             compen=compen+int(row.Amount)
>>         else:
>>             comfull=comfull+int(row.Amount)
>>             
>>     rows=db(db.Transaction_Master.Account==session.id).select()
>>     netdue=0
>>     for row in rows:
>>         netdue=netdue+int(row.Net_Due)
>>         
>>     pay=0
>>     rows=db(db.Payments.Account==session.id).select()
>>     for row in rows:
>>         pay=pay+int(row.Amount)
>>     a=[]
>>     b=[]
>>     count=0
>>     a.append([TH('Due Amount'),TH('Commited Amount'),TH('Commitment 
>> Fulfilled'),TH('Commitment Pending'),TH('Uncommitted Amount'),TH('Payments 
>> Received')])
>>     a.append([netdue,commtot,comfull,compen,pay])
>>     
>> COMMITMENTS=SQLFORM.grid(db.Commitments.Account==session.id,user_signature=False)
>>     
>> PAYMENTS=SQLFORM.grid(db.Payments.Account==session.id,user_signature=False)
>>     return dict(COMMITMENTS=COMMITMENTS,PAYMENTS=PAYMENTS,SUMMARY=TABLE(a))
> 
> 


Reply via email to