简体   繁体   中英

Xpages viewPanel open selected Document in Dialog

I have been trying to open a dialog from viewPanel. This dialog is opened There is no problem here but I want to load selected document in viewPanel. When I try to do it. Which document I click It does not matter. The latest(at the bottom) document is always loaded in Dialog. My problem is (I could not solve) how to get selected document in viewPanel into Dialog. If There is an example how to do it or If someone can explaing the way I need to follow please. I really appreciate that.

viewPanel 底部的文档正在打开

UPDATE: I have listes all of document in a table then When i double click on a document which opens dialog box.

<xp:table id="viewPanela" styleClass="xspRepeatTable" cellpadding="0" cellspacing="0" style="width:98%"> <xp:tr styleClass="xspHeaderRow">
<xp:td style="width:2%"></xp:td>
<xp:td>
<xp:label value="Title" id="label2"></xp:label></xp:td>
<xp:td><xp:label value="Abteilung" id="label3"></xp:label>
</xp:td>
</xp:tr>
<xp:repeat id="repeatList" value="#{javascript:dominoView}" var="ordnerData" rows="10" indexVar="repeatIndex">
<xp:tr id="tr1"><xp:td></xp:td><xp:td><xp:div id="div1"><xp:this.style> <![CDATA[#{javascript:var level = ordnerData.getIndentLevel(); 
if(level != null && level > 0){
 return "padding-left:" + (level * 10) + "px !important";}else{return ""; }}]]></xp:this.style>
<xp:text escape="true" id="computedField3"><xp:this.value><![CDATA[#{javascript:return "  " +ordnerData.getColumnValue('$92')}]]></xp:this.value></xp:text></xp:div></xp:td><xp:td><xp:text escape="true" id="computedField4" value="#{javascript:ordnerData.getColumnValue('$95')}"></xp:text>
 </xp:td>
 <xp:eventHandler event="ondblclick" submit="false">
<xp:this.script><![CDATA[var docid="{javascript:ordnerData.getDocument().getUniversalID()}";var link=""; var typee='#{javascript:viewScope.docUNID = ordnerData.getDocument().getUniversalID()}';
return XSP.openDialog('#{id:inPlaceDialog1}')  ]]></xp:this.script> </xp:eventHandler> </xp:tr> </xp:repeat>
<xp:tr styleClass="xspPagerRow"><xp:td colspan="4" align="right" style="width:100%"> <xp:pager xp:key="headerPager" for="repeatList" id="pagerTop" partialRefresh="true" style="font-weight:inherit;margin-right:0.0px" layout="SeparatorPage Status FirstArrow Separator PreviousArrow Separator SeparatorPage Group Separator NextArrow Separator LastArrow"> </xp:pager>
 </xp:td></xp:tr></xp:table>

UPDATE 2: Here is the dialog code that I try to load the document into

<xe:dialog id="inPlaceDialog1" title="Edit User"> 
        <xp:panel>
            <xp:this.data>
                <xp:dominoDocument var="document1" formName="Reports"
                    action="editDocument" ignoreRequestParams="true">
                    <xp:this.documentId><![CDATA[#{javascript:viewScope.docUNID}]]></xp:this.documentId>
                </xp:dominoDocument>
            </xp:this.data>
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="card-header bg-primary header-elements-inline">
                        <h5 class="modal-title">
                            <xp:text id="docUNID" value="#{viewScope.docUNID}"
                                escape="false">
                            </xp:text>
                            <xp:text escape="false" id="computedField1">
                                <xp:this.value><![CDATA[#{javascript:var txt = "YENİ RAPOR"; print(viewScope.docUNID);
if (viewScope.docUNID!=null)
    txt = document1.getItemValueString("StatuText");
return txt;}]]></xp:this.value>
                            </xp:text>
                        </h5>
                        <div class="header-elements">
                            <div class="list-icons">
                                <div class="">
                                     
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-header  text-white header-elements-inline">
                    </div>
                    <xp:div styleClass="modal-body" id="divBody">
                        <h6 class="font-weight-semibold"></h6>
                        <!-- <input type="text" name="" id="txtId"></input> -->
                        <xp:div styleClass="form-group">
                            <xp:label value="Rapor Türü:" id="label1"
                                styleClass="text-uppercase col-form-label  font-weight-bold">
                            </xp:label>
                            <xp:radioGroup id="RaporTuru" enabledClass="form-control border-primary">
                                <xp:this.value><![CDATA[#{javascript:var key = viewScope.docUNID;
                                
if (key!=null)
{
    var viewName = database.getView("viewReportsUnids")
    var doc:NotesDocument = viewName.getDocumentByKey(key, true);
    if (doc!=null)
    {
        return doc.getItemValueString("RaporTuru");
    }
}}]]></xp:this.value>
                                <xp:selectItems>
                                    <xp:this.value><![CDATA[#{javascript:try 
{
    var rListe:Array = [];
    rListe[0] = "Giriş Hareketleri";
    rListe[1] = "Çıkış Hareketleri";
    rListe[2] = "Giriş/Çıkış Hareketleri";
    rListe[3] = "Güncel Stok Raporu";
    return rListe;
}

catch(e)
{
    logError(e.toString(),
                session.getEffectiveUserName(),
                facesContext.getExternalContext().getRequest().getRequestURL(), 
                this.getParent().getId(), 
        "xspFrmRapor"); 
}}]]></xp:this.value>
                                </xp:selectItems>
                                <xp:eventHandler event="onchange" submit="true"
                                    refreshMode="partial" refreshId="divBody">
                                </xp:eventHandler>
                            </xp:radioGroup>

                        </xp:div>
                        <xp:div styleClass="form-group">
                            <xp:label value="Zaman Aralığı:" id="label4"
                                styleClass="text-uppercase col-form-label font-weight-bold">
                            </xp:label>
                            <xp:radioGroup id="RaporTipi" value="#{document1.RaporTipi}"
                                enabledClass="form-control border-primary">

                                <xp:selectItems>
                                    <xp:this.value><![CDATA[#{javascript:try 
{
    var rListe:Array = [];
    rListe[0] = "Tümü";
    rListe[1] = "Tarih Aralığı";
    return rListe;
}

catch(e)
{
    logError(e.toString(),
                session.getEffectiveUserName(),
                facesContext.getExternalContext().getRequest().getRequestURL(), 
                this.getParent().getId(), 
        "xspFrmRapor"); 
}}]]></xp:this.value>
                                </xp:selectItems>
                                <xp:eventHandler event="onchange" submit="true"
                                    refreshMode="partial" refreshId="divBody">
                                </xp:eventHandler>
                            </xp:radioGroup>

                        </xp:div>
                        <xp:div styleClass="form-group">
                            <xp:label value="Lokasyon (Şantiye):" id="label6"
                                styleClass="text-uppercase col-form-label  font-weight-bold">
                            </xp:label>
                            <xp:comboBox id="Lokasyon" value="#{document1.Lokasyon}"
                                styleClass="form-control">
                                <xp:selectItems>
                                    <xp:this.value><![CDATA[#{javascript:return "";}]]></xp:this.value>
                                </xp:selectItems>
                                <xp:selectItems id="selectItems6">
                                    <xp:this.value><![CDATA[#{javascript:var rList = @DbColumn(sessionScope.personel_db_Path, "viewLokasyon01", 1);
return rList;}]]></xp:this.value>
                                </xp:selectItems>
                                <xp:selectItems>
                                    <xp:this.value><![CDATA[#{javascript:return "TÜMÜ";}]]></xp:this.value>
                                </xp:selectItems>

                            </xp:comboBox>
                        </xp:div>

                        <xp:div styleClass="form-group">
                            <xp:label value="Stok Kategorisi:" id="label7"
                                styleClass="text-uppercase col-form-label  font-weight-bold">
                            </xp:label>
                            <xp:checkBoxGroup id="StokKategori" value="#{document1.StokKategori}"
                                enabledClass="form-control">
                                <xp:selectItems>
                                    <xp:this.value><![CDATA[#{javascript:var rList:java.util.Vector = new java.util.Vector();
rList.add("Parça");
rList.add("İşçilik");
rList.add("Yakıt");
rList.add("Yağ ve Adblue");
rList.add("Lastik");
return rList;}]]></xp:this.value>
                                </xp:selectItems>
                            </xp:checkBoxGroup>
                        </xp:div>
                        <xp:div styleClass="form-group">
                             
                            <xp:label value="Başlangıç Tarihi:" id="label8"
                                styleClass="text-uppercase col-form-label  font-weight-bold">
                            </xp:label>
                            <br></br>

                            <xe:djDateTextBox id="baslangicTarihi"
                                value="#{document1.baslangicTarihi}">
                                <xe:this.converter>
                                    <xp:convertDateTime type="date" dateStyle="short">
                                    </xp:convertDateTime>
                                </xe:this.converter>
                                <xe:this.dojoAttributes>
                                    <xp:dojoAttribute name="placeholder" value="01.01.2022">
                                    </xp:dojoAttribute>
                                </xe:this.dojoAttributes>
                                 
                            </xe:djDateTextBox>
                        </xp:div>
                        <xp:div styleClass="form-group">
                             
                            <xp:label value="Bitiş Tarihi" id="label10"
                                styleClass="text-uppercase col-form-label  font-weight-bold">
                            </xp:label>
                            <br></br>
                            <xe:djDateTextBox id="bitisTarihi" value="#{document1.bitisTarihi}"
                                styleClass="border-teal">
                                <xe:this.converter>
                                    <xp:convertDateTime type="date" dateStyle="short">
                                    </xp:convertDateTime>
                                </xe:this.converter>
                                <xe:this.dojoAttributes>
                                    <xp:dojoAttribute name="placeholder" value="01.01.2022">
                                    </xp:dojoAttribute>
                                </xe:this.dojoAttributes>
                                 
                            </xe:djDateTextBox>
                        </xp:div>

                    </xp:div>
                     
                </div>
            </div>
        </xp:panel>

         
    </xe:dialog>

I did not use rowAttributes to open document from the viewPanel. I put the code which opens modal behind a column(I used the first column in the viewPanel) and in the dialog that is beeing opened from the viewPanel I have a Panel with datasourse. Document ID of Datasource is viewScope.DocUNId. When i click on a documetn (Selected document from viewPanel) I assing selected document's UniqueId to viewScope.docUNID and then It works very well..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM