provide sublabels for multi-field groups in records cells
This commit is contained in:
parent
72528a62fc
commit
b7efdf6a33
2 changed files with 4 additions and 3 deletions
|
@ -43,9 +43,10 @@ from cybertools.util.format import toStr, toUnicode
|
||||||
|
|
||||||
class FieldGroup(object):
|
class FieldGroup(object):
|
||||||
|
|
||||||
def __init__(self, name, label):
|
def __init__(self, name, label, sublabels=[]):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.label = label
|
self.label = label
|
||||||
|
self.sublabels = sublabels
|
||||||
|
|
||||||
|
|
||||||
class Field(Component):
|
class Field(Component):
|
||||||
|
|
|
@ -57,12 +57,12 @@ class GridFieldInstance(ListFieldInstance):
|
||||||
if group is None:
|
if group is None:
|
||||||
result.append(dict(name=f.name,
|
result.append(dict(name=f.name,
|
||||||
label=(f.description or f.title),
|
label=(f.description or f.title),
|
||||||
fields=[f], indexes=[idx]))
|
fields=[f], indexes=[idx], group=None))
|
||||||
else:
|
else:
|
||||||
g = groups.get(group.name)
|
g = groups.get(group.name)
|
||||||
if g is None:
|
if g is None:
|
||||||
g = dict(name=group.name, label=group.label,
|
g = dict(name=group.name, label=group.label,
|
||||||
fields=[f], indexes=[idx])
|
fields=[f], indexes=[idx], group=group)
|
||||||
groups[group.name] = g
|
groups[group.name] = g
|
||||||
result.append(g)
|
result.append(g)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue