Crazy effect: I open a (previously saved) doc in read mode: Everthing is ok. When I change it into edit mode: All checkboxes are emptied. The other items (inputText, inputTextarea) on the xpage keep their values.
The effect doesn¨t occur when I open the page for the first time (of my browser session), but after that it happens every time.
code snippet:
<xp:panel id="pNewDoc" styleClass="panel panel-default">
<xp:this.data>
<xp:dominoDocument var="dshare" formName="dshare"
action="openDocument"
databaseName="webapp/peoplesearch/dshare.nsf">
<xp:this.documentId><![CDATA[#{javascript:viewScope.myUnid}]]></xp:this.documentId>
</xp:dominoDocument>
</xp:this.data>
<xp:this.rendered><![CDATA[#{javascript:viewScope.ShowDoc == "1"}]]></xp:this.rendered>
<div class="panel-heading">
<xp:label value="Desk Sharing Freigabe" id="label7"
for="inputText1" styleClass="panel-title">
</xp:label>
</div>
<xp:div styleClass="panel-body">
<div class="row hvrow">
<xp:label value="Owner" id="label2"
styleClass="col-sm-2 col-md-2">
</xp:label>
<xp:div styleClass="col-sm-4 col-md-4">
<xp:inputText id="inputText4"
value="#{dshare.anOwner}"
defaultValue="#{javascript:#UserName()}" disabled="true">
</xp:inputText>
</xp:div>
<xp:label value="Tel." id="label6"
styleClass="col-sm-2 col-md-2">
</xp:label>
<xp:div styleClass="col-sm-4 col-md-4">
<xp:inputText id="inputText5"
value="#{dshare.dsPhoneNumber}">
<xp:this.defaultValue><![CDATA[#{javascript:var
dbArray = [""];
dbArray.push("webapp/peoplesearch/psuser_20160610.nsf")
#DbLookup(dbArray,"lookupFullname",#UserName(),"OfficePhone")}]]></xp:this.defaultValue>
</xp:inputText>
</xp:div>
</div>
<div class="row">
<xp:label value="Von bis" id="label1"
styleClass="col-sm-2 col-md-2">
</xp:label>
<xp:div
styleClass="col-sm-4 col-md-4 form-inline">
<xp:inputText id="inputText1"
value="#{dshare.dsFrom}" style="width:45%">
<xp:dateTimeHelper id="dateTimeHelper3">
</xp:dateTimeHelper>
<xp:this.converter>
<xp:convertDateTime type="date"
dateStyle="short">
</xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
-
<xp:inputText id="inputText2"
value="#{dshare.dsTo}" style="width:45%">
<xp:dateTimeHelper id="dateTimeHelper4">
</xp:dateTimeHelper>
<xp:this.converter>
<xp:convertDateTime type="date"
dateStyle="short">
</xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
</xp:div>
<xp:label value="Zeitspanne" id="label3"
styleClass="col-sm-2 col-md-2">
</xp:label>
<xp:div styleClass="col-sm-4 col-md-4">
<xp:checkBoxGroup id="checkBoxGroup1"
value="#{dshare.dsPeriod}">
<xp:selectItem itemLabel="Vormittag"
itemValue="V">
</xp:selectItem>
<xp:selectItem itemLabel="Nachmittag"
itemValue="N">
</xp:selectItem>
</xp:checkBoxGroup>
</xp:div>
</div>
<div class="row">
<xp:label value="Details" id="label9"
styleClass="col-sm-2 col-md-2">
</xp:label>
<xp:div styleClass="col-sm-10 col-md-10">
<xp:inputTextarea id="inputTextarea1"
style="width:100%" rows="5" value="#{dshare.dsDetails}">
</xp:inputTextarea>
</xp:div>
<xp:label value="Status" id="label10"
styleClass="col-sm-2 col-md-2">
</xp:label>
<xp:div styleClass="col-sm-4 col-md-4">
<xp:checkBox text="aktiv" id="checkBox1"
value="#{dshare.dsStatus}" checkedValue="activ"
uncheckedValue="inactiv" defaultChecked="true">
</xp:checkBox>
</xp:div>
</div>
</xp:div>
<div class="panel-footer" style="text-align:right">
<xp:button value="Bearbeiten" id="btEdit" type="submit"
rendered="#{javascript:!dshare.isEditable()}">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" immediate="false" save="false"
refreshId="pNewDoc" execMode="partial" execId="pNewDoc">
<xp:this.action>
<xp:changeDocumentMode mode="edit"></xp:changeDocumentMode>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Speichern" id="btSave" type="submit"
rendered="#{javascript:dshare.isEditable()}">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" immediate="false" save="false"
refreshId="pDSall" execMode="partial" execId="pDSall">
<xp:this.action><![CDATA[#{javascript:viewScope.ShowDoc = "0"
qsave(dshare);}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
</div>
</xp:panel>
Your button has the property type="submit":
<xp:button
value="Bearbeiten"
id="button2"
type="submit"
rendered="#{javascript:!dshare.isEditable()}">
...
It is responsible for your issue.
Just delete type="submit" and your check boxes will work with setting edit mode by partial refresh:
<xp:button
value="Bearbeiten"
id="btEdit"
rendered="#{javascript:!dshare.isEditable()}">
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="partial"
immediate="false"
save="false"
refreshId="pNewDoc"
execMode="partial"
execId="pNewDoc">
<xp:this.action>
<xp:changeDocumentMode mode="edit"></xp:changeDocumentMode>
</xp:this.action>
</xp:eventHandler>
</xp:button>
Related
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.
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..
I have an XPages view with the first column as a link to launch the document for that row. I'm launching it in a dialog control and it works just fine, but it won't let me edit the document. I have an edit button on the dialog control to put it in edit mode, but it doesn't seem to work.
There are two datasources, one for the view and one for the document.
XPage:
<?xml version="1.0" encoding="UTF-8"?>
<xc:NewMainForm><xp:this.facets><xc:NewLogin xp:key="facet_Login "></xc:NewLogin>
<xc:FooterContent xp:key="facet_Footer"></xc:FooterContent>
<xc:HomeBodyContent xp:key="facet_Body"></xc:HomeBodyContent>
<xc:MenuContainer xp:key="facet_Menu"></xc:MenuContainer>
<xc:cc_headerRightContent xp:key="facet_HeaderRight">
</xc:cc_headerRightContent>
<xc:cc_headerCenterContent xp:key="facet_HeaderCenter">
</xc:cc_headerCenterContent>
<xc:cc_headerLeftContent xp:key="facet_HeaderLeft">
</xc:cc_headerLeftContent>
<xc:NewLogin xp:key="facet_Login"></xc:NewLogin></xp:this.facets>
</xc:NewMainForm></xp:view>
Custom Control:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex"
style="background-repeat:no-repeat;background-position:center center"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.resources>
<xp:script src="/xspDialog.js" clientSide="true"></xp:script>
<xp:styleSheet href="/Style.css"></xp:styleSheet>
</xp:this.resources>
<xp:panel>
<xp:inputText id="Search" value="#{viewScope.searchString}">
</xp:inputText>
<xp:button value="Search" id="button1"
style="background-color:rgb(57,88,137);color:rgb(255,255,255)">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="viewPanel1">
</xp:eventHandler>
</xp:button>
</xp:panel>
<!-- VIEW PANEL -->
<xp:viewPanel id="viewPanel1" pageName="/ByAcronym.xsp"
viewStyle="width:100%;background-
image:url(Music1+Big+twice+Faded.png);background-repeat:no-
repeat;background-position:center center;border-width:thick"
var="thisentry" rows="27">
<xp:this.facets>
<xp:pager partialRefresh="true" layout="Previous Group Next"
xp:key="headerPager" id="pager1">
</xp:pager>
<xp:viewTitle xp:key="viewTitle" id="viewTitle1"
value="By Title" style="color:rgb(255,128,0);font-weight:bold">
</xp:viewTitle>
<xp:pager partialRefresh="true" layout="Previous Group Next"
xp:key="footerPager" id="pager2">
</xp:pager>
</xp:this.facets>
<xp:this.data>
<xp:dominoView viewName="Songs" var="dsSongs"
ignoreRequestParams="true">
<xp:this.search><![CDATA[#{javascript:return
viewScope.get("searchString")}]]></xp:this.search>
</xp:dominoView>
</xp:this.data>
<!-- VIEWCOLUMN1 -->
<xp:viewColumn columnName="Title" id="viewColumn1"
displayAs="link" style="width: 750px">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="dialog1" id="eventHandler1">
<xp:this.action>
<![CDATA[#{javascript:viewScope.UNID =
thisentry.getDocument().getUniversalID();
getComponent('dialog1').show()}]]>
</xp:this.action>
</xp:eventHandler>
<xp:viewColumnHeader value="Title" id="viewColumnHeader1">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="MusicType" id="viewColumn2">
<xp:viewColumnHeader value="Music Type"
style="width: 250px" id="viewColumnHeader2">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="ComposedBy" id="viewColumn3">
<xp:viewColumnHeader value="Composer"
id="viewColumnHeader3">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="ArrangedBy"
id="viewColumn4">
<xp:viewColumnHeader value="Arranger"
id="viewColumnHeader4">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="Jonra" id="viewColumn5">
<xp:viewColumnHeader value="Jonra"
id="viewColumnHeader5">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="Seasonal" id="viewColumn6">
<xp:viewColumnHeader value="Seasonal"
id="viewColumnHeader6">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn id="viewColumn7" columnName="Location"
style="width:75px">
<xp:this.facets>
<xp:viewColumnHeader xp:key="header"
id="viewColumnHeader7" value="Location" style="width:750px">
</xp:viewColumnHeader>
</xp:this.facets>
</xp:viewColumn>
<xp:viewColumn id="viewColumn8" columnName="NumberOfCopies"
style="width:10.0px">
<xp:this.facets>
<xp:viewColumnHeader xp:key="header"
id="viewColumnHeader8" value="Number Of Copies"
style="width:750px">
</xp:viewColumnHeader>
</xp:this.facets>
</xp:viewColumn>
</xp:viewPanel>
<!-- DIALOG1-->
<xe:dialog id="dialog1" title="Details">
<xe:dialogContent id="dialogContent1">
<xp:panel
style="width:698.0px;background-
image:url(Music1+Big+twice+Faded.png);background-repeat:no-
repeat;background-position:center center;border-
color:rgb(57,88,137);border-style:solid;border-
width:thin;color:rgb(33,51,80)">
<xp:this.data>
<xp:dominoDocument var="document1"
formName="MusicForm" action="editDocument"
documentId="#{javascript:viewScope.UNID}"
ignoreRequestParams="true">
</xp:dominoDocument>
</xp:this.data>
<xp:table>
<xp:tr>
<xp:td>
<xp:label value="Music Type:"
id="musicType_Label1" for="musicType1"
style="font-weight:bold">
</xp:label>
<xp:br></xp:br>
<xp:inputText value="#{document1.MusicType}"
id="musicType1">
</xp:inputText>
</xp:td>
<xp:td>
<xp:label value="Title:" id="title_Label1"
for="title1" style="font-weight:bold">
</xp:label>
<xp:br></xp:br>
<xp:inputText value="#{document1.Title}"
id="title1">
</xp:inputText>
</xp:td>
<xp:td>
<xp:label value="Composed By:"
id="composedBy_Label1" for="composedBy1"
style="font-weight:bold">
</xp:label>
<xp:br></xp:br>
<xp:inputText value="#{document1.ComposedBy}"
id="composedBy1">
</xp:inputText>
</xp:td>
<xp:td>
<xp:label value="Arranged By:"
id="arrangedBy_Label1" for="arrangedBy1"
style="font-weight:bold">
</xp:label>
<xp:br></xp:br>
<xp:inputText value="#{document1.ArrangedBy}"
id="arrangedBy1">
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label value="Jonra:" id="jonra_Label1"
for="jonra1" style="font-weight:bold">
</xp:label>
<xp:br></xp:br>
<xp:inputText value="#{document1.Jonra}"
id="jonra1">
</xp:inputText>
</xp:td>
<xp:td>
<xp:label value="Season:"
id="seasonal_Label1" for="seasonal1"
style="font-weight:bold">
</xp:label>
<xp:br></xp:br>
<xp:inputText value="#{document1.Seasonal}"
id="seasonal1">
</xp:inputText>
</xp:td>
<xp:td>
<xp:label value="Location:"
id="location_Label1" for="location1"
style="font-weight:bold">
</xp:label>
<xp:br></xp:br>
<xp:inputText value="#{document1.Location}"
id="location1">
</xp:inputText>
</xp:td>
<xp:td>
<xp:label value="Number Of Copies:"
id="numberOfCopies_Label1" for="numberOfCopies1"
style="font-weight:bold">
</xp:label>
<xp:br></xp:br>
<xp:inputText
value="#{document1.NumberOfCopies}"
id="numberOfCopies1">
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td colspan="4">
<xp:messages layout="table"
style="color:red" id="messages1">
</xp:messages>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td colspan="4">
<xp:button id="button5" value="Save">
<xp:this.rendered><![CDATA[#
{javascript:if(document1.isNewNote()){
false
}else{
true
}}]]></xp:this.rendered>
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete"
id="eventHandler5">
<xp:this.action>
<xp:actionGroup>
<xp:executeScript
script="#
{javascript:document1.save()}">
</xp:executeScript>
<xp:openPage
name="/Main.xsp">
</xp:openPage>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button id="button4" value="Submit">
<xp:this.rendered><![CDATA[#
{javascript:if(document1.isNewNote()){
true
}else{
false
}}]]></xp:this.rendered>
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete"
immediate="false"
save="true" id="eventHandler2">
<xp:this.action>
<xp:actionGroup>
<xp:openPage
name="/Main.xsp">
</xp:openPage>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Edit" id="button2"
rendered="#
{javascript:!document1.isEditable()}">
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete"
id="eventHandler3">
<xp:this.action>
<xp:changeDocumentMode
mode="edit" var="document1">
</xp:changeDocumentMode>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button id="button3">
<xp:this.value><![CDATA[#
{javascript:if(document1.isEditable()){
"Cancel"
}else{
"Close"
}}]]></xp:this.value>
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete"
immediate="true"
save="false" id="eventHandler4">
<xp:this.action>
<xp:openPage name="/Main.xsp">
</xp:openPage>
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:td>
</xp:tr>
</xp:table>
</xp:panel>
</xe:dialogContent>
</xe:dialog>
</xp:view>
What am I doing wrong?
MJ
"Maximum Internet name and password" on the ACL's Advanced tab can limit access. If that's set to e.g. Reader, the highest access permitted for the application on the web will be Reader access, regardless of the individual's ACL settings. Author would only allow them to create, not edit existing documents that do not have an Authors field etc.
I have following custom control:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.beforePageLoad><![CDATA[#{javascript:compositeData.id = this.getId();
if (!compositeData.body_class) {compositeData.body_class='panel-body'};
if (!compositeData.panel_id) {compositeData.panel_id='section'+compositeData.id};}]]></xp:this.beforePageLoad>
<xp:panel>
<xp:this.styleClass><![CDATA[#{javascript:"ccSectionPanel panel " + compositeData.panel_class + ""}]]></xp:this.styleClass>
<xp:this.attrs>
<xp:attr name="id">
<xp:this.value><![CDATA[#{javascript:compositeData.panel_id}]]></xp:this.value>
</xp:attr>
</xp:this.attrs>
<xp:panel styleClass="panel-heading" style="cursor:pointer;">
<xp:this.attrs>
<xp:attr name="id">
<xp:this.value><![CDATA[#{javascript:compositeData.panel_id + "_heading"}]]></xp:this.value>
</xp:attr>
<xp:attr name="href">
<xp:this.value><![CDATA[#{javascript:"#" + compositeData.panel_id + "_section"}]]></xp:this.value>
</xp:attr>
<xp:attr name="data-toggle" value="collapse"></xp:attr>
</xp:this.attrs>
<xp:link escape="true" styleClass="panel-title"
text="#{javascript:compositeData.titleBarText}">
<xp:this.attrs>
<xp:attr name="id">
<xp:this.value><![CDATA[#{javascript:compositeData.panel_id + "_title"}]]></xp:this.value>
</xp:attr>
</xp:this.attrs>
<xp:this.id><![CDATA[${javascript:compositeData.panel_id + "_title"}]]></xp:this.id>
</xp:link>
</xp:panel>
<xp:panel>
<xp:this.styleClass><![CDATA[#{javascript:"panel-collapse collapse" + (compositeData.initClosed ? "" : " in")}]]></xp:this.styleClass>
<xp:this.attrs>
<xp:attr name="id">
<xp:this.value><![CDATA[#{javascript:compositeData.panel_id + "_section"}]]></xp:this.value>
</xp:attr>
</xp:this.attrs>
<xp:panel
styleClass="#{javascript:compositeData.body_class}">
<xp:callback facetName="panelBody" id="panelBody"></xp:callback>
</xp:panel>
<xp:panel rendered="#{javascript:compositeData.footer}"
styleClass="panel-footer">
<xp:callback facetName="panelFooter" id="panelFooter"></xp:callback>
</xp:panel>
</xp:panel>
</xp:panel>
</xp:view>
I use it in a repeat control:
<xp:repeat id="repeat1" rows="30" value="#{view1}"
var="repEntry" indexVar="index" repeatControls="false">
<xp:panel>
<xp:this.data>
<xp:dominoDocument var="doc"
action="openDocument"
documentId="#{javascript:repEntry.getNoteID()}"
ignoreRequestParams="true">
</xp:dominoDocument>
</xp:this.data>
<xc:ccSectionPanel initClosed="false"
panel_class="#{javascript:repEntry.getColumnValue('class')}"
footer="#{javascript:sessionScope.isAdmin}"
rendered="#{javascript:repEntry.getColumnValue('Status') == '1' || sessionScope.isAdmin}">
<xc:this.titleBarText><![CDATA[#{javascript:repEntry.getColumnValue('Title') + (repEntry.getColumnValue('Status') != '1' ? ' (скрыто)' : '')
}]]></xc:this.titleBarText>
<xp:this.facets>
<xp:panel xp:key="panelFooter">
<xp:button value="Редактировать"
id="button2" styleClass="btn btn-xs">
<i
class="glyphicon glyphicon-pencil">
</i>
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete">
<xp:this.action>
<xp:openPage
name="/index.xsp" target="editDocument"
documentId="#{javascript:repEntry.getNoteID()}">
</xp:openPage>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button
value="#{javascript:repEntry.getColumnValue('Status') != '1' ? 'Показать' : 'Скрыть'}"
id="button3" styleClass="#{javascript:'btn btn-xs'}">
<i
class="#{javascript:repEntry.getColumnValue('Status') != '1' ? 'glyphicon glyphicon-eye-open' : 'glyphicon glyphicon-eye-close'}">
</i>
<xp:eventHandler event="onclick"
submit="true" refreshMode="partial" disableValidators="true"
refreshId="content">
<xp:this.action><![CDATA[#{javascript:if (repEntry.getColumnValue('Status') == '1') {
doc.replaceItemValue('Status','0');
doc.replaceItemValue('Author',sessionScope.User.UserName);
doc.save();
} else {
doc.replaceItemValue('Status','1');
doc.replaceItemValue('Author',sessionScope.User.UserName);
doc.save();
}}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:text escape="false"
id="computedField2" styleClass="btn btn-xs">
<xp:this.value><![CDATA[#{javascript:'<i class="glyphicon glyphicon-user"></i>' + repEntry.getColumnValue('Author') + ' <i class="glyphicon glyphicon-time"></i>' + repEntry.getColumnValue('$1')
}]]></xp:this.value>
</xp:text>
</xp:panel>
<xp:panel xp:key="panelBody">
<!-- <xp:this.data>
<xp:dominoDocument var="doc" action="openDocument"
documentId="#{javascript:repEntry.getNoteID()}"
ignoreRequestParams="true">
</xp:dominoDocument>
</xp:this.data> -->
<xp:inputRichText
id="inputRichText2" value="#{doc.Body}" readonly="true"
rendered="false">
</xp:inputRichText>
<xp:text escape="false"
id="computedField1">
<xp:this.value><![CDATA[#{javascript:doc.getDocument().getFirstItem("Body").getMIMEEntity().getContentAsText(); }]]></xp:this.value>
</xp:text>
</xp:panel>
</xp:this.facets>
</xc:ccSectionPanel>
</xp:panel>
</xp:repeat>
When i set cumputed properties,
It works, but when i set panel_id to something relative to repEntry or doc, it throws error (repEntry is undefined). I can set "Create controls at page creation", but then I lose advantages of partial refresh.
The main question, why one costom property can work with repEntry, but other can't?
The answer comes down to when the property gets calculated. Compute it and add a print statement in the SSJS code and you'll see. IDs need to be calculated when the components get loaded, so at the earliest part of the processing. And most importantly this is when it's generating a single abstract set of components, not associated to a particular row entry, because it's not yet built the collection. Think of it like creating an abstract class before creating objects from it.
Based upon the value/selection in a radiobutton group control I want to display another div containing an edit box control.
The code does not work as expected. Although the scope variable is set, the div never appears again when the visibility is set to false and I change the radiobutton selected value to Yes.
What am I doing incorrect?
<div class="form-group">
<label class="control-label col-sm-4">Membership</label>
<div class="col-sm-8">
<xp:radioGroup value="#{employeeBean.employee.stafMember}" binding="#{stafMember}"
id="stafMember">
<xp:selectItem itemLabel="Yes" />
<xp:selectItem itemLabel="No" />
<xp:eventHandler event="onchange" submit="true"
refreshMode="partial" refreshId="stafMemberDept" disableValidators="true">
<xp:this.action><![CDATA[#{javascript:var thisVal = getComponent("stafMember").getValue();
viewScope.put("stafMember", thisVal);}]]></xp:this.action>
</xp:eventHandler>
</xp:radioGroup>
</div>
</div>
<xp:div styleClass="form-group"
id="stafMemberDept">
<xp:this.rendered><![CDATA[#{javascript:var thisVal = viewScope.get("stafMember");
if(thisVal=="Yes"){
return false;
}
else if (thisVal == "No"){
return true;
}
else{
return false;
}}]]></xp:this.rendered>
<!-- just some fields to test the value of the radio group -->
<xp:text escape="true" id="computedField1"
value="#{javascript:stafMember.getValue()}">
</xp:text>
<xp:text escape="true" id="computedField2">
<xp:this.value><![CDATA[#{javascript:getComponent("stafMember").getValue()}]]></xp:this.value>
</xp:text>
<xp:text escape="true" id="computedField3">
<xp:this.value><![CDATA[#{javascript:"v" + viewScope.get("stafMember") + "v"}]]></xp:this.value>
</xp:text>
<label class="control-label col-sm-4"
style="font-size: 75%">
Department:
</label>
<div class="col-sm-8">
<xp:inputText id="inputText1"></xp:inputText>
</div>
</xp:div>
You need to refresh a component that stays in the component tree in order to show/hide components. So surround your stafMemberDept div with annother div that you then refresh:
<xp:div id="divToBeRefreshed">
<xp:div styleClass="form-group" id="stafMemberDept">
<xp:this.rendered>
<![CDATA[#{javascript:var thisVal = viewScope.get("stafMember");
if(thisVal=="Yes"){
return false;
}
else if (thisVal == "No"){
return true;
}
else{
return false;
}}]]>
</xp:this.rendered>
<!-- just some fields to test the value of the radio group -->
<xp:text escape="true" id="computedField1" value="#{javascript:stafMember.getValue()}">
</xp:text>
<xp:text escape="true" id="computedField2">
<xp:this.value>
<![CDATA[#{javascript:getComponent("stafMember").getValue()}]]>
</xp:this.value>
</xp:text>
<xp:text escape="true" id="computedField3">
<xp:this.value>
<![CDATA[#{javascript:"v" + viewScope.get("stafMember") + "v"}]]>
</xp:this.value>
</xp:text>
<label class="control-label col-sm-4" style="font-size: 75%">
Department:
</label>
<div class="col-sm-8">
<xp:inputText id="inputText1"></xp:inputText>
</div>
</xp:div>
</xp:div>
In my dynamic view panel, I need to have sortable columns. Problem is when sorting a column it resubmits the XPage and whole content is refreshed. Is there a way to achieve sorting only on the dynamic view panel without submitting whole page? Also, I want to hide this control if selected view is empty.
Here is my code:
<xp:panel id="searchPanel">
<xp:table styleClass="table table-condensed" style="width:auto">
<xp:tr>
<xp:td style="border-top:0px" styleClass="text-nowrap" id="searchColumn">
<xp:inputText id="inputText1" value="#{viewScope.searchterm}" styleClass="form-control"></xp:inputText>
<xp:link escape="true" text="" id="searchLink">
<i class="fa fa-search" style="margin-left:5px"></i>
<xp:eventHandler event="onclick" refreshMode="partial" immediate="false" submit="true" refreshId="ddPanel">
<xp:this.action><![CDATA[#{javascript:var pager:com.ibm.xsp.component.xp.XspPager = getComponent("pager");
pager.gotoFirst();}]]></xp:this.action>
</xp:eventHandler>
</xp:link>
<xp:link escape="true" text="" id="clearSearchLink">
<i class="fa fa-times" style="margin-left:5px"></i>
<xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="ddPanel" onComplete="showHideTableToggle()">
<xp:this.action><![CDATA[#{javascript:viewScope.remove("searchterm");}]]></xp:this.action>
<xp:this.script><![CDATA[dojo.byId(getID("inputText1")).value=""]]></xp:this.script>
</xp:eventHandler>
</xp:link>
</xp:td>
<xp:td style="border-top:0px;padding-left:20px">
<xp:link escape="true" id="addButton" onclick="return false;" styleClass="btn btn-primary" style="color:rgb(255,255,255)" text="Add">
<i class="fa fa-plus" style="margin-right:5px"></i>
<xp:eventHandler event="onclick" submit="false" refreshMode="complete">
<xp:this.script><![CDATA[XSP.openDialog(getID('contentDialog'),'',{"docID":"","newDoc":"false"});]]></xp:this.script>
</xp:eventHandler>
</xp:link>
</xp:td>
</xp:tr>
</xp:table>
<xp:panel id="ddPanel">
<xe:dynamicViewPanel id="mainView" width="100%" dataTableStyleClass="table table-bordered table-condensed table-hover" rows="10" var="myView"
showColumnHeader="true" customizerBean="com.hcl.igdm.PickerViewBeanMainViews" partialRefresh="true" refreshId="ddPanel"
>
<xe:this.data>
<xp:dominoView var="mainDataView" dataCache="nodata">
<xp:this.viewName><![CDATA[#{javascript:sessionScope.showView.split("~")[0]}]]></xp:this.viewName>
</xp:dominoView>
</xe:this.data>
<xe:this.rowAttrs>
<xp:attr name="onClick">
<xp:this.value><![CDATA[#{javascript:return "javascript:myJSFunction();"}]]></xp:this.value>
</xp:attr>
</xe:this.rowAttrs>
</xe:dynamicViewPanel>
<xp:pager layout="Previous Group Next" partialRefresh="true" id="pager" for="mainView" title="Pager"></xp:pager>
</xp:panel>
It's a long time ago this question was placed... but maybe the answer can help other people.
You can put the dynamicViewPanel into a 'dynamic content' container (from ExtLib) with partial events attribute set to true. This will convert the full update events into partial refresh events.
<xe:dynamicContent partialEvents="true">
...
</xe:dynamicContent>