I am using SQLFORM.grid and I need to wrap a big chunk of text (one of the data elements) in a CSS class called "big-chunk".
I remember it wasn't hard to add a CSS class to a dal field, but I can't seem to find the solution.
I tried this method:
db.define_table('table',
Field('combitext', 'text', represent=lambda x,row: XML(<div class="big-chunk">+x+</div>) ),
),
This works great except, when displaying the full grid, the text-heavy field would be output in a whole big chunk. Appadmin also displays the whole text when in table format.
I tried to limit the number of characters using maxtextlengths in SQLFORM.grid but it isn't working either (whole chunk of text appears). I know that from this experience it proves that db.table.field.represent will ensure that it will appear the way you want it to, but I only need it to appear like that when I click on "VIEW" on the grid.
Note: I need to wrap the value of the text output (in view mode) in a class, I do not need to add a class to a form field. thanks
I appreciate any help.