Hi Web2py User
i am using smart sql grid. i am trying to take value from drop down.
according to that i am fetching data in grid. my grid is working fine but
when ever i click on edit view buttons. i will not work as it should to be
bork. it refress the same page.
plese my code below....
view part
{{left_sidebar_enabled,right_sidebar_enabled=True,('message' in globals())}}
{{extend 'layout.html'}}
<div id="select_option">
<form name="cnf"
action="{{=URL('default','service_search')}}" method="post"
onsubmit="return showcnf()" >
View By: <select name="cars">
<option value="">Select View</option>
<option value="All">All</option>
<option value="Due This Month">Due This Month</option>
<option value="Due Today">Due Today</option>
<option value="DueTomorrow">DueTomorrow</option>
</select>
<input type="submit" value="GO"
style="height:25px;padding :2px;">
</form>
</div>
<div style="float left">
{{=form}}
</div>
controler part
def a_search():
subject=request.vars.cars
d_today = datetime.date.today()
if subject == 'Due Today':
query = ((db.mytable.due_date == d_today) & (
db.mytable.Compliance_Area == 'st'))
session.grid =
SQLFORM.smartgrid(db.mytable,linked_tables=['submit_detail'], csv=False ,
constraints = dict(mytable = query), paginate=15 ,
sorter_icons=(XML('↑'), XML('↓')) , deletable=False,
create=False,showbuttontext=False)
response.flash = T(" Due Today")
elif subject == 'DueTomorrow':
t_day = datetime.date.today() + datetime.timedelta(days=1)
query = ((db.mytable.due_date == t_day) & (
db.mytable.Compliance_Area == 'st'))
session.grid =
SQLFORM.smartgrid(db.mytable,linked_tables=['submit_detail'], csv=False ,
constraints = dict(mytable = query), paginate=15 ,
sorter_icons=(XML('↑'), XML('↓')) , deletable=False,
create=False,showbuttontext=False)
response.flash = T(" Due Tomorrow")
elif subject == 'Due This Month':
date = datetime.date.today()
start_date = datetime.datetime(date.year, date.month, 1)
end_date = datetime.datetime(date.year, date.month,
calendar.mdays[date.month])
query = (((db.mytable.due_date >= start_date) |
(db.mytable.due_date >= end_date)) & ( db.mytable.Compliance_Area == 'st'))
session.grid =
SQLFORM.smartgrid(db.mytable,linked_tables=['submit_detail'], csv=False,
constraints = dict(mytable = query), paginate=15 ,
sorter_icons=(XML('↑'), XML('↓')) , deletable=False,
create=False,showbuttontext=False)
response.flash = T(" Due This Month")
elif subject == 'All':
query = (( db.mytable.Compliance_Area == 'st'))
session.grid =
SQLFORM.smartgrid(db.mytable,linked_tables=['submit_detail'], csv=False ,
constraints = dict(mytable = query), paginate=15 ,
sorter_icons=(XML('↑'), XML('↓')) , deletable=False)
response.flash = T(" All")
return dict(form = session.grid)
can any one help me to sole that issues....
--
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.