Xpages - se crea conflicto cada vez que se guarda un documento
-
21-12-2019 - |
Pregunta
Tengo una xpage, con múltiples pestañas.La primera pestaña contiene un panel, cuyo contenido es editable solo cuando está Note () es verdadero.Así que calculé el atributo readonly para el panel.
Pero cada vez que guardo el documento, está creando un nuevo documento de conflicto.
En el Sametime, si desmarque la propiedad de solo lectura, se está ahorrando correctamente sin ningún conflicto.
¿Puede alguien ayudarme a resolver este problema?
código - xpage
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.data>
<xp:dominoDocument var="document1"
formName="frmOnboardingRequest">
</xp:dominoDocument>
</xp:this.data>
<xp:panel>
<xp:this.readonly><![CDATA[#{javascript:if(document1.isNewNote()){
return false;
}else{
return true;
}}]]></xp:this.readonly>
<xp:table>
<xp:tr>
<xp:td>
<xp:label value="O n_ e d_ form completed by:"
id="oN_ED_FormCompletedBy_Label1" for="oN_ED_FormCompletedBy1">
</xp:label>
</xp:td>
<xp:td>
<xp:inputText
value="#{document1.ON_ED_EmployeeName}"
id="oN_ED_FormCompletedBy1">
</xp:inputText>
</xp:td>
</xp:tr>
</xp:table></xp:panel>
<xp:button value="Submit" id="button1"><xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="false" save="true"></xp:eventHandler></xp:button></xp:view>
Solución
Compruebe si hay múltiples datos de datos que señalan el mismo documento.
algunos puestos antes con el mismo problema xpage Crea Guardar conflicto en Guardar / enviar
Múltiples fuentes de datos en xpages
=================================================
Editar
Tuve que cambiar el código del botón a esto para obtener el mismo problema
<xp:button value="Submit" id="button1"><xp:eventHandler event="onclick" refreshMode="complete" submit="true">
<xp:this.action>
<xp:saveDocument></xp:saveDocument>
</xp:this.action></xp:eventHandler></xp:button>
Después de algunas pruebas más, intente esto.
Agregue este campo al final de la XPAGE
<xp:inputText id="inputText1"
value="#{document1.temp}"
style="visibility:hidden;display:none">
</xp:inputText>
Entonces no se crean conflictos.
Otros consejos
Strange indeed - but also not. Your data source is bound to the page and not to the panel. So if you want to set read mode only for that panel, consider to calculate the panel's datasource from the page's datasource:
<xp:panel>
<xp:this.data>
<xp:dominoDocument var="document1" action="openDocument"></xp:dominoDocument>
</xp:this.data>
</xp:panel>
Of course you have to calculate the document mode and the docid instead of using the readonly property.
In addition to the other suggestions, when working with tabbed tables you will want to follow this blog post carefully. I have been through similar issues on a previous project and Tommy Valand's redirectToCurrentDocument() fixed them.
http://dontpanic82.blogspot.com/2010/06/xpages-avoid-saving-duplicate-documents.html