I am trying to get PowerTable to show referenced records (like that in the
PowerTable-examples (category - products) but I could so far not get that
working (Is there other documentation available?).
I have used this
powerTable.extrajs = dict(autoresize={},
tooltip={},
details={'detailscolumns':'outeur_art_ekw.skrywer',
'detailscallback':URL('default','skrywerdetails')
})
def skrywerdetails():
key = None
cols = None
for k in request.vars.keys():
if k[:3] == 'dt_':
key = request.vars[k]
elif k[:6] == 'dtcols':
cols = request.vars[k]
tablename = key.split('.')[0]
fieldname = key.split('.')[1]
value = key.split('.')[2]
print tablename, fieldname, value
plugin_powertablesdb.products.picture.represent=lambda
r:repr_picture(r,height='30px',alt='Product')
if cols:
cols = cols.split(',')
row =
plugin_powertablesdb(plugin_powertablesdb.outeur_art_ekw.artikel==value).select(*cols)
else:
row =
plugin_powertablesdb(plugin_powertablesdb.outeur_art_ekw.artikel==value).select()
tbl = SQLTABLE(row,headers='labels',truncate=32)
div = DIV(H3(T('Authors %s' % value)))
div.append(tbl)
table = TABLE()
for i,r in enumerate(row):
tr = TR()
for td in r:
tr.append(td)
table.append(tr)
if i >3:
break
print tbl
return tbl
The fact that the this function never gets executed tells me that i am on
the wrong track.
A simplified model:
db.define_table("artikel",
Field("titel", "string", notnull=True))
db.define_table('outeur_art_ekw',
Field('artikel', db.artikel,
requires = IS_IN_DB(db, 'artikel.id')),
Field('skrywer', db.outeur,
requires = IS_IN_DB(db, 'outeur.id')))
db.outeur_art_ekw.skrywer.represent = lambda id: db.outeur(id).van + ' ' +
db.outeur(id).voorletters
In the example there is a + link on each row. I don't get that and I could
not see in the example code how to get that.
I hope someone can help me with this.
Regards
Johann
--
May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord! His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a