records field: evaluate style properties in edit form; use correct display macro

This commit is contained in:
Helmut Merz 2012-02-13 18:31:47 +01:00
parent 1ef004cd1c
commit 180ab86be6
2 changed files with 17 additions and 10 deletions

View file

@ -42,37 +42,43 @@
tal:define="fieldInstance python: field.getFieldInstance(view.instance);
columns fieldInstance/columnTypes;
rows data/?name">
<table class="records">
<table class="records" style="width: auto">
<thead>
<tr>
<tal:header repeat="column columns">
<th tal:attributes="field column/name;"
<th tal:attributes="class string:${column/baseField/cssClass|string:}"
tal:content="column/title">Column Title</th>
</tal:header>
</tr>
</thead>
<tbody tal:attributes="id string:tbody.$name">
<tr tal:repeat="row rows">
<td tal:repeat="column columns">
<input type="text"
<td tal:repeat="column columns"
tal:attributes="class string:${column/baseField/cssClass|string:}">
<input type="text" style="width: auto"
tal:define="cname column/name"
tal:attributes="value row/?cname;
name string:$name.$cname:records;" /></td>
name string:$name.$cname:records;
style string:width: ${column/baseField/width|string:auto};" /></td>
</tr>
<tal:empty condition="python: not field.cardinality
or field.cardinality > len(rows)">
<tr>
<td tal:repeat="column columns">
<td tal:repeat="column columns"
tal:attributes="class string:${column/baseField/cssClass|string:}">
<input type="text"
tal:define="cname column/name"
tal:attributes="name string:$name.$cname:records" /></td>
tal:attributes="name string:$name.$cname:records;
style string:width: ${column/baseField/width|string:auto};" /></td>
</tr>
<tr style="display: none"
tal:attributes="id string:$name.empty">
<td tal:repeat="column columns">
<input type="text"
<td tal:repeat="column columns"
tal:attributes="class string:${column/baseField/cssClass|string:}">
<input type="text" style="width: auto"
tal:define="cname column/name"
tal:attributes="name string:$name.$cname:records" /></td>
tal:attributes="name string:$name.$cname:records;
style string:width: ${column/baseField/width|string:auto};" /></td>
</tr>
</tal:empty>
</tbody>

View file

@ -46,6 +46,7 @@ class Records(Grid):
__typeInfo__ = ('records',
FieldType('records', 'records',
u'A series of records or rows.',
displayRenderer='display_records',
instanceName='records',))