It seems that it's been a long day... {{if not rows:}} No matches found {{else:}} {{=SQLTABLE(rows,headers={"field.id":"custom name id", "field.name":"custom name"})}} {{pass}}
more simple... impossible... Sorry for wasting your time :( On 5 nov, 18:06, demetrio <dgzabal...@gmail.com> wrote: > I think I got excited too soon. I tried these method and it seems that > it not works. > > This is the traceback: > > Traceback (most recent call last): > File "/home/demetrio/devel/web2py_devel/trunk/devel/web2py/gluon/ > restricted.py", line 188, in restricted > exec ccode in environment > File "/home/demetrio/devel/web2py_devel/trunk/devel/web2py/ > applications/calendar/views/calendars/search.html", line 97, in > <module> > File "/home/demetrio/devel/web2py_devel/trunk/devel/web2py/gluon/ > sqlhtml.py", line 1192, in __init__ > columns = sqlrows.colnames > AttributeError: 'list' object has no attribute 'colnames' > > One question, i'm using web2py Version 1.87.3. Can it be that this > funcionality is applied on trunk or newer versions? > > Thx again for your time. > > On 2 nov, 16:04, demetrio <dgzabal...@gmail.com> wrote: > > > Thanks a lot Massimo! > > > On 2 nov, 14:58, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > Yes. In the view, instead of > > > > {{=rows}} > > > > do > > > > {{=SQLTABLE(rows,headers=....)}} > > > > On Nov 2, 5:43 am, demetrio <dgzabal...@gmail.com> wrote: > > > > > Hi, first of all sorry if I made any mistake in english :) > > > > > When i try to make acrud.search(), i can customize the names of the > > > > search form, but i cant do the same with the results' headers. > > > > > def search(): > > > > db.licenses.id.represent = lambda id: \ > > > > DIV(A('edit',_href=URL(r=request, f='update', args=(id)))," ", > > > > A('read',_href=URL(r=request, f='read', args=(id)))," > > > > ",A('delete',_onclick="return confirm('" + T("Are you sure to delete?") > > > > +"')",_href=URL(r=request, f='delete', args=(id)))) > > > > form, rows =crud.search(db.licenses, field_labels = > > > > {'id':'ID','name':'Name'}) > > > > return dict(form=form, rows=rows) > > > > > With this, code my form is something like: > > > > > <checkbox> ID <select> <input> > > > > <checkbox> Name <select> <input> > > > > > but my results table is: > > > > > licenses.id licenses.name > > > > -------------------------------------------------- > > > > edit read delete resultname1 > > > > edit read delete resultname2 > > > > edit read delete resultname3 > > > > > Do you know if there is any posibility to customize that header > > > > names?, > > > > > it will be nice if I could use the "headers" parameter like in the > > > >crud.search() method because you can do something like this modifying > > > > the represent of the id > > > > > Search Form: > > > > <checkbox> **ID** <select> <input> > > > > <checkbox> Name <select> <input> > > > > > Results: > > > > > **Actions** Name > > > > -------------------------------------------------- > > > > edit read delete resultname1 > > > > edit read delete resultname2 > > > > edit read delete resultname3 > > > > > notice that the field licenses.id in the form is named **ID**, and in > > > > the results is named **Actions** > > > > > Thats all, thanks in advance :) > >