当我单击重复网格左上角的默认添加按钮时,它不会添加新行。 我的模型如下:
<form><myproject>
<CalcAdditionalServices>
<CalcAdditionalService>
<AdditionalServicesCode>d</AdditionalServicesCode>
<AdditionalServicesSurcharge>1</AdditionalServicesSurcharge>
<AdditionalServicesReason>Reason</AdditionalServicesReason>
</CalcAdditionalService>
<CalcAdditionalService>
<AdditionalServicesCode>e</AdditionalServicesCode>
<AdditionalServicesSurcharge>2</AdditionalServicesSurcharge>
<AdditionalServicesReason>Reason</AdditionalServicesReason>
</CalcAdditionalService>
</CalcAdditionalServices>
</myproject></form>
我有以下约束
<xf:bind id="CalcAdditionalServices-bind" ref="CalcAdditionalServices" name="CalcAdditionalServices">
<xf:bind id="CalcAdditionalService-bind" ref="CalcAdditionalService">
<xf:bind id="AdditionalServicesCode-bind" ref="AdditionalServicesCode"/>
<xf:bind id="AdditionalServicesReason-bind" ref="AdditionalServicesReason"/>
<xf:bind id="AdditionalServicesSurcharge-bind" ref="AdditionalServicesSurcharge" name="AdditionalServicesSurcharge" type="xf:decimal"/>
</xf:bind>
</xf:bind>
以及以下重复网格:
<fr:section id="CalcAdditionalServices-control" bind="CalcAdditionalServices-bind">
<fr:grid id="CalcAdditionalService-grid"
repeat="true"
bind="CalcAdditionalService-bind"
template="instance('fr-form-instance')"
min="0" >
<xh:tr>
<xh:td>
<xf:select1 xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="AdditionalServicesCode-control"
bind="AdditionalServicesCode-bind"
class="">
<xf:itemset nodeset="instance('fr-form-instance')//Entity[@type='AdditionalServices']">
<xf:label ref="Description[@language='de']/text()"/>
<xf:value ref="@code"/>
</xf:itemset>
</xf:select1>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
首先,我想填充重复的网格(正在工作),然后允许用户添加一个新行(不起作用)
答案 0 :(得分:1)
我看到您使用<xf:instance id="CalcAdditionalServices-template">
<CalcAdditionalService>
<AdditionalServicesCode/>
<AdditionalServicesReason/>
<AdditionalServicesSurcharge/>
</CalcAdditionalService>
</xf:instance>
。这可能不是您要找的模板。
模板必须只包含将插入的位以创建新的重复迭代。所以:
template="instance('CalcAdditionalServices-template')"
你会用它来引用它:
Date
这就是说,我认为你正在寻找麻烦这样做。这实际上是由表单生成器生成的。
但是如果您仍然希望手动完成,最好的办法是首先使用表单生成器,查看它生成的代码,然后密切关注。