One more time: in sqlhtml.py we have:
if headers=='fieldname:capitalize': headers = {} for c in columns: headers[c] = ' '.join([w.capitalize() for w in c.split('.')[-1].split('_')]) so what about including the peace of code I mentioned? if headers=='labels': headers = {} for c in columns: tablename = ' '.join([w for w in c.split('.')[0].split('_')]) fieldname = ' '.join([w for w in c.split('.')[-1].split('_')]) headers[c] = sqlrows.db[tablename][fieldname].label 2010/12/6 Bruno Rocha <rochacbr...@gmail.com> > I do not want a form, a need to use the plugin_datatable. > > Finally what I did: > > # In models > def get_header_labels(table=None): > headers = {} > for field in db[table].fields: > headers[table+'.'+field] = db[table][field].label > return headers > > > # in My view/controller > > list = SQLTABLE(db(db.category.id>0). select(db.category.id, > db.category.name), > headers = get_header_labels('category')) > > > > > > > 2010/12/6 mdipierro <mdipie...@cs.depaul.edu> > > if you make a form there is a dict in form.custom.label[fielname] or >> form.custom.label.fielname >> >> On Dec 6, 5:19 pm, Bruno Rocha <rochacbr...@gmail.com> wrote: >> > OK, I found that labels are in db.fieldname.label, now I just have to >> create >> > a dict. >> > >> > 2010/12/6 Bruno Rocha <rochacbr...@gmail.com> >> > >> > >> > >> > >> > >> > >> > >> > > HI, >> > >> > > I have a 'category' table: >> > >> > > db.define_table('category', >> > > Field('name',label=T('Name')), >> > > signature, >> > > format='%(name)s' >> > > ) >> > >> > > which I defined a label for the field 'name' >> > >> > > I need to create something like: >> > >> > > list = plugin_datatable(db(db.category.id>0).select(db.category.id, >> > > db.category.name), >> > > _class='datatable', >> > > headers = {'category.name':T('Name')}, >> > > ) >> > >> > > Is there a way to pass my previously defined labels to the SQLTABLE? >> > >> > > where the 'labels' are stored? I tried db.category.labels, >> > > db.category['labels'] ? >> > >> > > Thanks >> > >> > > -- >> > >> > > Bruno Rocha >> > >http://about.me/rochacbruno/bio >> > >> > -- >> > >> > Bruno Rochahttp://about.me/rochacbruno/bio >> > > > > -- > > Bruno Rocha > http://about.me/rochacbruno/bio > -- Bruno Rocha http://about.me/rochacbruno/bio