I am working on a project where we have a different subsystem whose API returns a list of certain type of objects. I want it to be displayed on my form. Can I use SQLForm.grid for this? Please suggest. |
if searchform.accepts(request.vars,keepvalues=True):
searchform.process()
if searchform.process(keepvalues=True).accepted:Hi Massimo,
temp_db = cache.ram('tmp_db',lambda: DAL('sqlite:memory').define_table('mytable',*fields)._db, None)
temp_db.mytable.truncate()
for obj in result['output']:
temp_db.mytable.insert(ID=obj['id'],
Method=obj['method'],
Date=obj['date'],
Status=obj['status'],
Account=obj['account'],
Name=obj['name'],
Amount1=obj['amount1'],
Amount2=obj['amount2'],
Type=obj['type'])
x = SQLFORM.grid(temp_db.mytable,create=False, deletable=False,
editable=False, maxtextlength=64, paginate=2,searchable=False,details=False)
else:
response.flash = 'please fill the form'
return dict(form=searchform,result=result,x=x)When postback happens due to any sorting or paging action, searchform.accepts(request.vars,keepvalues=True) fails and no grid gets displayed. Please help me to fix this.Thank you
On Sunday, 8 September 2013 19:17:03 UTC+5:30, Massimo Di Pierro wrote:
searchform.process(keepvalues=True).acceptedif searchform.accepts(request.vars,keepvalues=True):Hi Anthony,Thanks for this useful information.I triedsearchform.process(keepvalues=True).acceptedBut it evaluates to False.While below given line evaluates to True.if searchform.accepts(request.vars,keepvalues=True):I dont know why does it happen. Have I done anything wrong over here?Could you please suggest any solution to achieve sorting and paging in this scenario?Thank you.
On Tuesday, 10 September 2013 16:43:22 UTC+5:30, Anthony wrote: