0

ドキュメント データ ソースにバインドされたページがあります。ページの上部には、ドキュメントのフィールドが設定されているパネルがあります。ページの下部には、ドキュメントのビューがあります。

フィールドが [A] と [B] で、[B] の値が [A] に依存しているとします。[A] は、値が変更されると [B] を部分的に更新します。部分的な更新をトリガーしない [A] を設定して送信/保存を押すと、ドキュメントが保存され、ページが完全に更新され、ドキュメントが下のビューに表示されます。

しかし、[B] が更新されるように [A] を設定してから送信/保存を押すと、ドキュメントは保存されますが、ドキュメントはビューに表示されません。ビューを更新するには、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:スクリプト>
        <xp:script src="#{javascript:sessionScope.jQueryUI}"
         clientSide="true">
        </xp:スクリプト>
        <xp:script src="#{javascript:sessionScope.jQueryBlockUI}"
         clientSide="true">
        </xp:スクリプト>
        <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="メインパネル">

        <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:スパン>
        <xp:br></xp:br>
        <xp:panel styleClass="upload-details-panel">
            <xp:span>アップロード:</xp:span>
            <xp:fileUpload id="fileUpload1" value="#{attachmentDoc.Attachment}"></xp:fileUpload>
        </xp:パネル>
        <xp:panel styleClass="upload-details-panel">
            <span>タイプ:</span>
            <xp:comboBox id="cbUploadType" value="#{attachmentDoc.File_Type}"
            styleClass="cbUploadType">
                <xp:selectItem itemLabel="添付ファイル"></xp:selectItem>
                <xp:selectItem itemLabel="eCR マスター ファイル"></xp:selectItem>

                <xp:selectItem itemLabel="財務分析"></xp:selectItem>
                <xp:eventHandler event="onchange" submit="true"
               refreshMode="partial" refreshId="panelUploadDetails">
                </xp:イベントハンドラ>
            </xp:コンボボックス>
        </xp:パネル>

        <xp:panel id="panelUploadDetails">
            <xp:panel styleClass="upload-details-panel">
                <xp:this.rendered><![CDATA[#{javascript:var uploadType = getComponent("cbUploadType").getValue();
if(uploadType == "添付ファイル" || uploadType == null){
    false を返します。
}
true を返す;}]]></xp:this.rendered>
                <span>区分:</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 データベース設定", 1)));}]]></xp:this.value>
                    </xp:selectItems>
                    <xp:eventHandler event="onchange" submit="true"
                  refreshMode="部分的"
                  refreshId='#{javascript:var uploadType = getComponent("cbUploadType").getValue();
if(uploadType == "財務分析"){
    「panelFAType」を返します。
}
「パネルエクストラ」を返します。
}'>

                    </xp:イベントハンドラ>

                </xp:コンボボックス>

            </xp:パネル>
            <xp:panel id="panelExtra">
                <!--
               これは、部門の部分的な更新をリダイレクトするために使用されます
               非FAの選択
            -->
            </xp:パネル>
            <xp:panel styleClass="upload-details-panel" id="panelFAType">

                <xp:this.rendered><![CDATA[#{javascript:var uploadType = getComponent("cbUploadType").getValue();
if(uploadType == "財務分析"){
    true を返します。
}
false を返す;}]]></xp:this.rendered>
                <span>財務分析タイプ:</span>
                <xp:comboBox id="comboBoxFAType" value="#{attachmentDoc.FAType}">
                    <xp:selectItems>
                        <xp:this.value><![CDATA[#{javascript:var division = getComponent("comboBox1").getValue();
if(除算!=ヌル){
    return getFATypeOptions(getComponent("comboBox1").getValue());
}
return "---";}]]></xp:this.value>
                    </xp:selectItems>
                </xp:コンボボックス>
            </xp:パネル>
        </xp:パネル>
        <xp:panel styleClass="upload-details-panel">
            <スパン></スパン>
            <xp:button id="btnUpload" value="アップロード" styleClass="btnUpload"
            スタイル="高さ: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("データをドキュメントにインポート");

//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('フォーム', '添付ファイル');
   doc.computeWithForm(真、偽);

    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);

    // ファイル拡張子を取得    
    var extension:string = '';
    var newFileName:string = '';
    var i:int;

   i = clientFileName.lastIndexOf('.');
   もし (私 > 0) {
       extension = clientFileName.substring(i+1);
   }  

   doc.replaceItemValue('File_Extension', 拡張子);    
    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);

    newFile.renameTo(savedFile);

    doc.replaceItemValue("File_Size", savedFile.length())
    doc.replaceItemValue("Processed_eCR_Template", "");

    // 新しいファイルを保存します
    if (savedFile.exists()) {
      // これは、添付ファイルのアイコン/外観を保持するために使用されます
      // ドキュメント内      
      //doc.replaceItemValue('Attachment', attDoc.getItemValue('Attachment'));

      doc.save();
    } そうしないと {
      //requestScope.errorMessage = 'サーバー ファイルが見つかりません';
      print('サーバーファイルが見つかりません');
    }
} そうしないと {
   requestScope.errorMessage = 'ファイルが見つかりません';
   print('ファイルが見つかりません');
}

// このコードは、ユーザーが更新したときにアップロードされたファイルの再送信を防ぎます
// ページ
// var curURL = window.location.href;
// var NSFURL = curURL.toLowerCase().split( '.nsf')[0] + '.nsf';


// window.location.href = NSFURL}]]></xp:this.action>
                    <xp:this.script><![CDATA[//送信前にフィールドを検証する

var uploadType = document.getElementById("#{id:cbUploadType}").value;
if(uploadType == "添付ファイル"){
    true を返します。
}そうしないと{
    var division = document.getElementById("#{id:comboBox1}").value;
    if(除算 == "---"){
        alert("区分を指定してください。");
        false を返します。
    }
    if(uploadType == "eCR マスター ファイル"){
        true を返します。
    }else if(uploadType == "財務分析"){
        var faType = document.getElementById("#{id:comboBoxFAType}").value;
        if(faType == "---"){
            alert("財務分析タイプを指定してください。");
            false を返します。
        }そうしないと{
            true を返します。
        }
    }
}

//アップロードの種類が認識されない場合
alert("アップロード タイプが認識されません。管理者に連絡してください。");
false を返します。

]]></xp:this.script>
                </xp:イベントハンドラ>
            </xp:ボタン>

        </xp:パネル>
        <xp:panel id="panelUploadedFiles">

            <xp:viewPanel rows="30" id="viewPanel1" viewStyle="width:100%">
                <xp:this.facets>
                    <xp:pager partialRefresh="true" layout="前のグループ 次"
                  xp:key="headerPager" id="pager1">
                    </xp:ポケットベル>
                </xp:this.facets>
                <xp:this.data>
                    <xp:dominoView var="view1" viewName="Web 用の添付ファイル"
                  keys="#{javascript:@UserName()}" categoryFilter="File_Owner">
                    </xp:ドミノビュー>
                </xp:this.data>

                <xp:viewColumn columnName="ファイル名" id="viewColumn2">
                    <xp:viewColumnHeader value="ファイル名"
                  id="viewColumnHeader2">
                    </xp:viewColumnHeader>
                </xp:viewColumn>
                <xp:viewColumn columnName="Date_Uploaded" id="viewColumn3">
                    <xp:viewColumnHeader value="アップロード日"
                  id="viewColumnHeader3">
                    </xp:viewColumnHeader>
                </xp:viewColumn>
                <xp:viewColumn columnName="Last_Attached" id="viewColumn4">
                    <xp:viewColumnHeader value="最後に添付"
                  id="viewColumnHeader4">
                    </xp:viewColumnHeader>
                </xp:viewColumn>
            </xp:viewPanel>
        </xp:パネル>
    </xp:パネル>
    <xp:br></xp:br>
</xp:表示>

部分的な更新をトリガーする要素は、コンボボックス (onchange) です。保存ボタンは「アップロード」ボタンです。パネル panelUploadedFiles にはビューが含まれています。

4

1 に答える 1

2

最初の質問から問題を診断する方法がないため、サンプル コードを投稿する必要があります。

「 XPages MasterClass」トレーニングを受けることをお勧めします。ざっくり四時間くらいです。このような問題のデバッグに使用できるXPages Toolboxの使用方法を示します。

于 2013-09-04T14:14:52.233 に答える