Hi!!
I'm using powertable plugin for a simple app I have the following:
(Model)
db.define_table('location',
Field('name','string'),format='%(name)s')
db.define_table('car',
Field('name','string'),
Field('model','string'),
Field('location_id',db.location),
Field('price','string'),
Field('status','string'),
Field('owner','string'),
Field('phone','string'),
Field('comments','text'),,format='%(name)s')
(Controller init/default)
def index():
powerTable = plugins.powerTable
powerTable.datasource = db.car
powerTable.dtfeatures['sScrollY'] = '338'
powerTable.dtfeatures['sScrollX'] = '100%'
powerTable.headers = 'labels'
powerTable.showkeycolumn = False
powerTable.dtfeatures['bJQueryUI'] =
request.vars.get('jqueryui',True)
powerTable.uitheme =
request.vars.get('theme','smoothness')#'smoothness'
powerTable.dtfeatures['sPaginationType'] =
request.vars.get('pager','scrolling') # two_button full_numbers
powerTable.keycolumn = 'car.id'
powerTable.columns = ['car.name',
'car.model',
'car.location_id',
'car.price',
'car.status'
]
powerTable.extrajs = dict(autoresize={},
details={'detailscolumns':'car.owner,\
car.phone,\
car.comments'
})
return dict(table=powerTable.create())
(View init/default/index)
{{extend 'layout.html'}}
<center><h2>Welcome test app</h2></center>
{{=table}}
But I'd like to do this:
Before showing the table with all the data, I need to have a dropdown
with the location_id and according to the location the user has
selected is the data that is shown.
So for example if I have 3 locations (garage,office,other) and the
user selects "garage" It must only show the table with the records
where location_id = garage.
How could I do this, I have some ideas, but nothing clear.