Dear All.
How a i can call a javascript function from a link of sqlform.grid
My controller:
d=datetime.datetime.strptime(request.vars.desde, "%d/%m/%Y %H:%M:%S") \ if
request.vars.desde else
datetime.datetime.strptime(datetime.datetime.strftime(datetime.datetime.now(),'%Y-%m-%d
00:00:00'), \ '%Y-%m-%d %H:%M:%S')
h=datetime.datetime.strptime(request.vars.hasta, "%d/%m/%Y %H:%M:%S") \ if
request.vars.hasta else
datetime.datetime.strptime(datetime.datetime.strftime(datetime.datetime.now(),'%Y-%m-%d
23:59:59'), \ '%Y-%m-%d %H:%M:%S')
form = SQLFORM.factory(Field('desde','datetime',
requires=IS_DATETIME(format='%Y-%m-%d %H:%M:%S'),default=d),
Field('hasta','datetime',requires=IS_DATETIME(format='%Y-%m-%d
%H:%M:%S'), default=h),formstyle='table2cols',method='POST')
orderby=~db.mensajes.id links=[dict(header='Detalle',body=lambda row:
A(IMG(_src=URL(c='static',f='images/view.png'), _width=24, _height=24),
_href=URL('showsms', args=[row.mensajes.id])))] #links = [lambda row: A('Ver
SMS',_href=URL("default","showsms",args=[row.id]))]
query=(db.mensajes.id_cia==auth.user.cia) & (db.mensajes.fenvio>=d) &
(db.mensajes.fenvio<=d)
left=[db.estadosms.on(db.mensajes.estado==db.estadosms.id)]
fields=[db.mensajes.id,db.mensajes.numero,db.mensajes.msg,db.mensajes.fecha,db.mensajes.fenvio,db.mensajes.fentrega,db.mensajes.respuesta,db.mensajes.frespuesta,db.estadosms.n$
if form.process().accepted:
d,h=form.vars.desde,form.vars.hasta
query=(db.mensajes.id_cia==auth.user.cia) & (db.mensajes.fenvio>=d) &
(db.mensajes.fenvio<=h)
table=SQLFORM.smartgrid(db.mensajes,
constraints=dict(mensajes=query),fields=fields,orderby=orderby,left=left,searchable=True,args=request.args[:1],links=links,
exportclasses=dict(xml=False, html=False, json=False, tsv=False,
tsv_with_hidden_cols=False),details=False,create=False,editable=False,deletable=False,csv=True,paginate=50,formstyle='bootstrap')
return dict(form=form,table=table)
My View:{{extend 'layout.html'}}
<h3>Formulario Reporte Mensajes</h3>
<div id='wath-me' class="form-group"> {{=form}}</div> <div id='wath-me'
class="form-group"> {{=table}}</div>
<script>
function getData(id) { alert('blablabla');
}</script>
How i call function getData(id) from link of sqlform.smartgrid and this
function receive id row as parameter?
--
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.