我在html表中尝试使用Autoforms和数组字段。到目前为止,我可以修改行并删除它们,但我无法确定如何添加新行。添加按钮似乎没有做任何事情。
到目前为止我的代码:
{{#autoForm id="eventDatesForm" type="update" collection="Events" doc=this buttonContent="Save"}}
<h2>Event Dates</h2>
{{> afQuickField name="timezone"}}
<table class="table table-bordered table-hover table-condensed">
<thead>
<tr>
<th>Slice Start</th>
<th>Slice End</th>
<th><button type="button" class="btn btn-primary autoform-add-item" data-autoform-field="{{this.atts.name}}" data-autoform-minCount="{{this.atts.minCount}}" data-autoform-maxCount="{{this.atts.maxCount}}"><span class="glyphicon glyphicon-plus"></span></button></th>
</tr>
</thead>
{{#afEachArrayItem name="WiFiOffloadSettings"}}
<tbody>
<tr>
<td>{{> afFieldInput name=this.current.offloadSliceStart type=datetime}}</td>
<td>{{> afFieldInput name=this.current.offloadSliceEnd type=datetime}}</td>
<td><button type="button" class="btn btn-danger btn-sm autoform-remove-item"><span class="glyphicon glyphicon-minus"></span></button></td>
</tr>
</tbody>
{{/afEachArrayItem}}
</table>
<button type="submit" class="btn btn-primary">Save</button>
{{/autoForm}}
答案 0 :(得分:1)
在“添加”按钮中,尝试使用名称&#34; WiFiOffloadSettings&#34;。
即,
<button type="button" class="btn btn-primary autoform-add-item"
data-autoform-field="WiFiOffloadSettings" data-autoform-minCount="
{{this.atts.minCount}}" data-autoform-maxCount= {this.atts.maxCount}}">
<span class="glyphicon glyphicon-plus"></span> </button>