Orbeon XForms:重复网格添加新行问题
Orbeon XForms: repeated grid add new row issue
当我点击重复网格左上角的默认添加按钮时,它没有添加新行。
我的模型如下:
<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>
首先,我想填充重复的网格(有效),然后允许用户添加新行(无效)
我看到你使用 template="instance('fr-form-instance')"
。这可能不是您要找的模板。
模板必须只包含将被插入以创建新的重复迭代的位。所以:
<xf:instance id="CalcAdditionalServices-template">
<CalcAdditionalService>
<AdditionalServicesCode/>
<AdditionalServicesReason/>
<AdditionalServicesSurcharge/>
</CalcAdditionalService>
</xf:instance>
你会用以下方式引用它:
template="instance('CalcAdditionalServices-template')"
这就是说,我认为您是在自找麻烦。这真的是为Form Builder制作而设计的。
但如果您仍想手动完成,最好的办法是先使用 Form Builder,查看它生成的代码,然后密切关注它。
当我点击重复网格左上角的默认添加按钮时,它没有添加新行。 我的模型如下:
<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>
首先,我想填充重复的网格(有效),然后允许用户添加新行(无效)
我看到你使用 template="instance('fr-form-instance')"
。这可能不是您要找的模板。
模板必须只包含将被插入以创建新的重复迭代的位。所以:
<xf:instance id="CalcAdditionalServices-template">
<CalcAdditionalService>
<AdditionalServicesCode/>
<AdditionalServicesReason/>
<AdditionalServicesSurcharge/>
</CalcAdditionalService>
</xf:instance>
你会用以下方式引用它:
template="instance('CalcAdditionalServices-template')"
这就是说,我认为您是在自找麻烦。这真的是为Form Builder制作而设计的。
但如果您仍想手动完成,最好的办法是先使用 Form Builder,查看它生成的代码,然后密切关注它。