On Tuesday, July 25, 2017 at 8:32:55 PM UTC-4, Seth J wrote: > > I have a similar problem with maxtextlengths and I do have the "represent" > attribute set like so: > Field('f_last_change', type='text', > label=T('Latest Changes'), > default = '', > represent=lambda text, row: HTML(XML('' if text is > None else text.replace('\n', '<br />')), sanitize=True, > permitted_tags=['br/']) > ) > > Any suggestions how to keep the formatting, but still have field > truncated? Thanks!!! >
The built-in truncation works only with single strings -- it will not inspect your HTML and figure out how to do something intelligent with it (it is not even clear how you would want to handle truncation with multi-line HTML text). You should instead handle any truncation yourself in the represent function and set maxtextlength to a large value so the grid doesn't do any further truncation. Anthony -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.