[gen] List and grid fields: bugfixes.

This commit is contained in:
Gaetan Delannay 2015-03-18 19:53:57 +01:00
parent 3e6027c499
commit e5356e749d
2 changed files with 11 additions and 0 deletions

View file

@ -74,6 +74,13 @@ class Dict(List):
# while encoding/viewing this entry. # while encoding/viewing this entry.
self.keys = keys self.keys = keys
def computeWidths(self, widths):
'''Set given p_widths or compute default ones if not given.'''
if not widths:
self.widths = [''] * (len(self.fields) + 1)
else:
self.widths = widths
def getFormattedValue(self, obj, value, layoutType='view', def getFormattedValue(self, obj, value, layoutType='view',
showChanges=False, language=None): showChanges=False, language=None):
'''Formats the dict value as a list of values''' '''Formats the dict value as a list of values'''

View file

@ -99,6 +99,10 @@ class List(Field):
field.layouts = field.formatLayouts(subLayouts) field.layouts = field.formatLayouts(subLayouts)
# One may specify the width of every column in the list. Indeed, using # One may specify the width of every column in the list. Indeed, using
# widths and layouts of sub-fields may not be sufficient. # widths and layouts of sub-fields may not be sufficient.
self.computeWidths(widths)
def computeWidths(self, widths):
'''Set given p_widths or compute default ones if not given.'''
if not widths: if not widths:
self.widths = [''] * len(self.fields) self.widths = [''] * len(self.fields)
else: else: