In models,I have only 1 table.By multiple tables,I mean multiple tables in
view.I found a jquery plugin for sorting data in a single table.That is why
I wrote multiple tables so that no one will suggest jquery plugin for that.
I tried your code but it is not working. Can you please tell if I have made
any mistake.My code is as shown below.
In models
db.define_table('listspace',
Field('warehouse_location'),
Field('warehouse_totalsize'),
Field('contract_rent'))
In controller
def GetAllApprovedWarehouses():
if request.vars.orderby == 'size':
orderby = db.listspace.warehouse_totalsize
elif request.vars.orderby == 'rent':
orderby = db.listspace.contract_rent
else:
orderby = db.listspace.warehouse_location
listSpaceRequests = db(db.listspace.id > 0).select(orderby=orderby)
return dict(listSpaceRequests=listSpaceRequests)
On Monday, July 4, 2016 at 5:26:55 AM UTC+5:30, pbreit wrote:
>
> We might need to see some of your code, specifically your models.
>
> Why do you have multiple tables?
>
> I could see you having one table called "property" such as:
>
> db.define_table('property',
> Field('location'),
> Field('size'),
> Field('rent'))
>
> And then in your controller:
>
> def search():
> if request.vars.orderby == 'size':
> orderby = db.property.size
> elif request.vars.orderby == 'rent':
> orderby = db.property.rent
> else:
> orderby = db.property.location
> properties = db(db.property.id>0).select(orderby=orderby)
> return dict(properties=properties)
>
> Then a URL:
>
> http://mysite.com/search?orderby=rent
>
>
>
>
> On Saturday, July 2, 2016 at 4:36:17 AM UTC-7, pbt wrote:
>>
>> I am new to web2py .Thanks in advance. Please help me doing this. I have
>> multiple tables with one record in each table as shown in the screenshot.I
>> want to sort the tables using different parameters of the table. I want to
>> keep a drop-down to sort records according to rent,size,location,etc...
>>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.