Thanks Anthony!
On Monday, November 4, 2013 9:41:04 PM UTC+8, Anthony wrote:
>
> Maybe something like:
>
> def mygrid():
> if 'view' in request.args:
> db.table.combitext.represent = lambda x, row: DIV(x, _class=
> 'big-chunk')
> return dict(grid=SQLFORM.grid(db.table)
>
> Anthony
>
> On Monday, November 4, 2013 2:51:49 AM UTC-5, lyn2py wrote:
>>
>> 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.
>>
>
--
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/groups/opt_out.