XPages-视图不';t在发生部分刷新时更新

XPages-视图不';t在发生部分刷新时更新,xpages,lotus-notes,page-refresh,Xpages,Lotus Notes,Page Refresh,我有一个绑定到文档数据源的页面。页面顶部是一个面板,其中设置了文档的字段。页面底部是文档的视图 假设字段是[A]和[B],而[B]的值取决于[A],后者会根据某个值的变化部分刷新[B]。当我刚刚设置[A]时,不会触发部分刷新,然后按submit/save,文档被保存,页面完全更新,文档显示在下面的视图中 但如果我将[A]设置为[B]刷新,然后按“提交/保存”,则会保存文档,但该文档不会显示在视图中。我需要通过按URL栏中的ENTER键来重新加载页面以更新视图。试图对此进行研究,但没有结果 您认为

我有一个绑定到文档数据源的页面。页面顶部是一个面板,其中设置了文档的字段。页面底部是文档的视图

假设字段是[A]和[B],而[B]的值取决于[A],后者会根据某个值的变化部分刷新[B]。当我刚刚设置[A]时,不会触发部分刷新,然后按submit/save,文档被保存,页面完全更新,文档显示在下面的视图中

但如果我将[A]设置为[B]刷新,然后按“提交/保存”,则会保存文档,但该文档不会显示在视图中。我需要通过按URL栏中的ENTER键来重新加载页面以更新视图。试图对此进行研究,但没有结果

您认为我可以如何更新上一个场景的视图

以下是简化代码:

<?xml version="1.0" encoding="UTF-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom" style="font-size:11pt;font-weight:bold"> <xp:this.beforePageLoad> <![CDATA[#{javascript:var currLocation=context.getUrl(); var webDBPath=@LeftBack(currLocation,"/"); sessionScope.jQuery=webDBPath+"/jquery.min.js"; sessionScope.jQueryUI=webDBPath+"/jquery-ui.min.js"; sessionScope.jQueryBlockUI=webDBPath+"/jquery.blockUI.js"}]]> </xp:this.beforePageLoad> <xp:this.data> <xp:dominoDocument var="attachmentDoc" formName="Attachment"></xp:dominoDocument> </xp:this.data> <xp:this.resources> <xp:script src="#{javascript:sessionScope.jQuery}" clientSide="true"> </xp:script> <xp:script src="#{javascript:sessionScope.jQueryUI}" clientSide="true"> </xp:script> <xp:script src="#{javascript:sessionScope.jQueryBlockUI}" clientSide="true"> </xp:script> <xp:script src="/home.js" clientSide="true"></xp:script> <xp:styleSheet href="/style.css"></xp:styleSheet> <xp:styleSheet href="/jquery-ui.css"></xp:styleSheet> <xp:script src="/utils.jss" clientSide="false"></xp:script> </xp:this.resources> <xp:span style="font-weight:bold;font-size:11pt"></xp:span> <xp:span style="font-size:14pt"></xp:span> <xp:span style="font-weight:bold;font-size:11pt"></xp:span> <xp:inputText id="reUploadAttachmentID" style="display: none;" styleClass="reUploadAttachmentID"></xp:inputText> <xp:br style="font-size:11pt"></xp:br> <xp:panel style="margin-left:auto;margin-right:auto;width:940.0px" id="mainPanel"> <xp:span style="font-size:14pt"></xp:span> <xp:span style="font-size:14pt"></xp:span> <xp:br style="font-weight:bold"></xp:br> <xp:br></xp:br> <xp:inputText id="errorMessage" value="#{requestScope.errorMessage}" styleClass="errorMessage"></xp:inputText> <xp:span style="font-weight:bold"></xp:span> <xp:span style="font-weight:bold"> <xp:span style="font-weight:bold"></xp:span> </xp:span> <xp:br></xp:br> <xp:panel styleClass="upload-details-panel"> <xp:span>Upload:</xp:span> <xp:fileUpload id="fileUpload1" value="#{attachmentDoc.Attachment}"></xp:fileUpload> </xp:panel> <xp:panel styleClass="upload-details-panel"> <span>Type:</span> <xp:comboBox id="cbUploadType" value="#{attachmentDoc.File_Type}" styleClass="cbUploadType"> <xp:selectItem itemLabel="Attachment"></xp:selectItem> <xp:selectItem itemLabel="eCR Master File"></xp:selectItem> <xp:selectItem itemLabel="Financial Analysis"></xp:selectItem> <xp:eventHandler event="onchange" submit="true" refreshMode="partial" refreshId="panelUploadDetails"> </xp:eventHandler> </xp:comboBox> </xp:panel> <xp:panel id="panelUploadDetails"> <xp:panel styleClass="upload-details-panel"> <xp:this.rendered><![CDATA[#{javascript:var uploadType = getComponent("cbUploadType").getValue(); if(uploadType == "Attachment" || uploadType == null){ return false; } return true;}]]></xp:this.rendered> <span>Division:</span> <xp:comboBox id="comboBox1" value="#{attachmentDoc.File_Database}" styleClass="cbUploadDatabase"> <xp:selectItems> <xp:this.value><![CDATA[#{javascript:var options = ["---"]; return options.concat(@Unique(@DbColumn("", "eCR Database Settings", 1)));}]]></xp:this.value> </xp:selectItems> <xp:eventHandler event="onchange" submit="true" refreshMode="partial" refreshId='#{javascript:var uploadType = getComponent("cbUploadType").getValue(); if(uploadType == "Financial Analysis"){ return "panelFAType"; } return "panelExtra"; }'> </xp:eventHandler> </xp:comboBox> </xp:panel> <xp:panel id="panelExtra"> <!-- this is just used to redirect partial refresh of Division Selection for non-FA --> </xp:panel> <xp:panel styleClass="upload-details-panel" id="panelFAType"> <xp:this.rendered><![CDATA[#{javascript:var uploadType = getComponent("cbUploadType").getValue(); if(uploadType == "Financial Analysis"){ return true; } return false;}]]></xp:this.rendered> <span>Financial Analysis Type:</span> <xp:comboBox id="comboBoxFAType" value="#{attachmentDoc.FAType}"> <xp:selectItems> <xp:this.value><![CDATA[#{javascript:var division = getComponent("comboBox1").getValue(); if(division != null){ return getFATypeOptions(getComponent("comboBox1").getValue()); } return "---";}]]></xp:this.value> </xp:selectItems> </xp:comboBox> </xp:panel> </xp:panel> <xp:panel styleClass="upload-details-panel"> <span></span> <xp:button id="btnUpload" value="Upload" styleClass="btnUpload" style="height:26.0px"> <xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="false" save="true"> <xp:this.action><![CDATA[#{javascript: var fileData:com.ibm.xsp.http.UploadedFile = facesContext.getExternalContext().getRequest().getParameterMap().get(getClientId('fileUpload1')); var db:NotesDatabase = session.getCurrentDatabase(); var agent = database.getAgent("Import Data to Document"); //var attDoc:NotesDocument = attachmentDoc.getDocument(); //var doc:NotesDocument = db.createDocument(); var doc:NotesDocument = attachmentDoc.getDocument(); var settingsDoc:NotesDocument = db.getProfileDocument("eCRFilesDBConfiguration", ""); var repositoryPath:String; if (fileData != null) { //doc.replaceItemValue('Form', 'Attachment'); doc.computeWithForm(true, false); var clientFileName:String = fileData.getClientFileName(); var newFile:java.io.File = new java.io.File(fileData.getServerFileName()); var filePath:string = doc.getItemValueString("File_Path"); doc.replaceItemValue('File_Name', clientFileName); // get file extension var extension:string = ''; var newFileName:string = ''; var i:int; i = clientFileName.lastIndexOf('.'); if (i > 0) { extension = clientFileName.substring(i+1); } doc.replaceItemValue('File_Extension', extension); newFileName = doc.getUniversalID() + '.' + extension; //var savedFile:java.io.File = new java.io.File('C:\\' + newFileName); //var savedFile:java.io.File = new java.io.File('C:\\' + clientFileName); repositoryPath = settingsDoc.getItemValueString("FileRepositoryPath") var savedFile:java.io.File = new java.io.File(repositoryPath + newFileName); newFile.renameTo(savedFile); doc.replaceItemValue("File_Size", savedFile.length()) doc.replaceItemValue("Processed_eCR_Template", ""); // Save the new file if (savedFile.exists()) { // this is used to retain the icon/appearance of the attachment // in the document //doc.replaceItemValue('Attachment', attDoc.getItemValue('Attachment')); doc.save(); } else { //requestScope.errorMessage = 'Server file not found'; print('Server file not found'); } } else { requestScope.errorMessage = 'No File found'; print('No File found'); } // this code prevents resubmit of the uploaded file when the user refreshes // the page // var curURL = window.location.href; // var NSFURL = curURL.toLowerCase().split( '.nsf')[0] + '.nsf'; // window.location.href = NSFURL}]]></xp:this.action> <xp:this.script><![CDATA[//validate fields before submission var uploadType = document.getElementById("#{id:cbUploadType}").value; if(uploadType == "Attachment"){ return true; }else{ var division = document.getElementById("#{id:comboBox1}").value; if(division == "---"){ alert("Please specify the division."); return false; } if(uploadType == "eCR Master File"){ return true; }else if(uploadType == "Financial Analysis"){ var faType = document.getElementById("#{id:comboBoxFAType}").value; if(faType == "---"){ alert("Please specify the Financial Analysis Type."); return false; }else{ return true; } } } //if upload type not rcognized alert("Upload Type not recognized. Please contact you administrator."); return false; ]]></xp:this.script> </xp:eventHandler> </xp:button> </xp:panel> <xp:panel id="panelUploadedFiles"> <xp:viewPanel rows="30" id="viewPanel1" viewStyle="width:100%"> <xp:this.facets> <xp:pager partialRefresh="true" layout="Previous Group Next" xp:key="headerPager" id="pager1"> </xp:pager> </xp:this.facets> <xp:this.data> <xp:dominoView var="view1" viewName="Attachments For Web" keys="#{javascript:@UserName()}" categoryFilter="File_Owner"> </xp:dominoView> </xp:this.data> <xp:viewColumn columnName="File_Name" id="viewColumn2"> <xp:viewColumnHeader value="File Name" id="viewColumnHeader2"> </xp:viewColumnHeader> </xp:viewColumn> <xp:viewColumn columnName="Date_Uploaded" id="viewColumn3"> <xp:viewColumnHeader value="Date Uploaded" id="viewColumnHeader3"> </xp:viewColumnHeader> </xp:viewColumn> <xp:viewColumn columnName="Last_Attached" id="viewColumn4"> <xp:viewColumnHeader value="Last Attached" id="viewColumnHeader4"> </xp:viewColumnHeader> </xp:viewColumn> </xp:viewPanel> </xp:panel> </xp:panel> <xp:br></xp:br> </xp:view> 上传: 类型: 分部: 财务分析类型: 0) { 扩展名=clientFileName.substring(i+1); } doc.replaceItemValue('文件扩展名',扩展名); newFileName=doc.getUniversalID()+'。+扩展名; //var savedFile:java.io.File=new java.io.File('C:\\'+newFileName); //var savedFile:java.io.File=new java.io.File('C:\\'+clientFileName); repositoryPath=settingsDoc.getItemValueString(“FileRepositoryPath”) var savedFile:java.io.File=new java.io.File(repositoryPath+newFileName); 重命名为(savedFile); doc.replaceItemValue(“文件大小”,savedFile.length()) doc.replaceItemValue(“已处理的eCR模板”,“”); //保存新文件 if(savedFile.exists()){ //这用于保留附件的图标/外观 //在文件中 //doc.replaceItemValue('Attachment',attDoc.getItemValue('Attachment'); doc.save(); }否则{ //requestScope.errorMessage='未找到服务器文件'; 打印('未找到服务器文件'); } }否则{ requestScope.errorMessage='未找到文件'; 打印(“未找到文件”); } //此代码防止用户刷新时重新提交上载的文件 //页面 //var curURL=window.location.href; //var NSFURL=curURL.toLowerCase().split('.nsf')[0]+'.nsf'; //window.location.href=NSFURL}]>
触发部分刷新的元素是组合框(onchange)。保存按钮是“上传”按钮。面板UploadedFiles包含该视图。

您需要发布示例代码,因为无法从初始问题诊断您的问题


我建议参加“”培训。大约四个小时。它将向您展示如何使用,您可以使用它来调试此类问题

保存按钮中的更新选项是什么?我建议发布您的SaveButtonXML源代码。我认为我们还需要一些实际的代码。页面的简化版本以及事件代码都会很有帮助。