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!!!


On Friday, June 12, 2015 at 12:07:20 PM UTC-4, Anthony wrote:
>
> Which version of web2py? Also, have you set the "represent" attribute on 
> the field in question?
>
> And just to be clear, is the problem that the actual text truncation isn't 
> happening where you expect, or is it just that the physical width of the 
> table column is smaller than you'd like? Maybe show a screenshot.
>
> Anthony
>
> On Friday, June 12, 2015 at 12:27:27 AM UTC-4, jackso...@quantachrome.com 
> <javascript:> wrote:
>>
>> I get the same truncated display for the log message text no matter what 
>> I set maxtextlengths...This app is rock+1 on the IQ simplicity scale and 
>> yet it does not work...BTW: I removed all layouts stuff so its not some css 
>> problem. The truncated fields are what the grid wants to display. Its like 
>> the grid is on autopilot, any suggestions???
>>
>> MODEL:
>>
>> db2 = DAL('sqlite://autoflowLog.sqlite')
>> db2.define_table('log_messages',
>>     Field('time_stamp', length=30),
>>     Field('log_message_text', length = 256))
>> db2.log_messages.id.readable = False
>>
>> VIEW:
>>
>> <p>AutoFlow Log</p>
>> <h2>Log Messages:</h2>
>> {{=form}}
>>
>>
>> CONTROLLER:
>>
>> def display_log():
>>     grid = SQLFORM.grid(db2.log_messages, editable = False, searchable = 
>> False,formstyle = 'divs',maxtextlengths={'log_messages.log_message_text' : 
>> 80})
>>     return dict(form=grid)
>>
>

-- 
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.

Reply via email to