使用此代码从重复控件编辑多值字段。如果值列表不大/快但值列表很大会将数据慢慢带到对话框(bootstrap)
重复控制中的此按钮代码
<xp:button value="-" id="submitButtonId2" styleClass = "btn btn-success">
<xp:eventHandler event="onclick" submit="true" refreshMode="partial"
refreshId="pnlRow" disableValidators="true" id="eventHandler3">
<xp:this.action><![CDATA[#{javascript:viewScope.index = rowIndex;
EditRow();}]]></xp:this.action></xp:eventHandler>
<xp:this.attrs> <xp:attr name="data-toggle" value="modal">
</xp:attr>
<xp:attr name="data-target" value="#OrderRow">
</xp:attr>
</xp:this.attrs>
</xp:button>
EditRow脚本lib函数
var arRowDesc = document1.getItemValueArray("RowDesc")[index];
getComponent("RestipDesc").setValue(arRowDesc);
var arBrand = document1.getItemValueArray("Brand")[index];
getComponent("pickBrand").setValue(arBrand);
var arModel = document1.getItemValueArray("Model")[index];
getComponent("pickModel").setValue(arModel);
var arSupCode = document1.getItemValueArray("SupCode")[index];
getComponent("inSupCode").setValue(arSupCode);
var arQuantity = document1.getItemValueArray("Quantity")[index];
getComponent("RestipQuantity").setValue(arQuantity);
var arUnit = document1.getItemValueArray("Unit")[index];
getComponent("inUnit").setValue(arUnit);
var arListPrice = document1.getItemValueArray("ListPrice")[index];
getComponent("pickListPrice").setValue(arListPrice);
var arDisc = document1.getItemValueArray("Disc")[index];
getComponent("pickDisc").setValue(arDisc);
var arVat = document1.getItemValueArray("Vat")[index];
getComponent("pickVat").setValue(arVat);
var arOTVRows = document1.getItemValueArray("OTVRows")[index];
getComponent("pickOtv").setValue(arOTVRows);
答案 0 :(得分:0)
我建议避免这种模式:
var value = document.getItemValueArray("field")[index];
getComponent("component").setValue(value);
通过EL将组件绑定到文档:
value="#{document1.field[index]}"
您需要重做保存按钮,我假设您同样选择更新的值并将其传输到文档。
只显示该组件,因此您的编辑按钮将切换编辑组件的可见性。