XPages view data source and limit to single category - xpages

I have a categorized view that I am using as a view data source in an XPage. I have set the categoryFilter of the data source so that only the call history of the selected individual (for a given incident) is displayed. The filter being stored in the sessionScope is a concatenation of the UniqueID of the person and the IncidentID. The lookup view is categorized by that value.
One would expect that to work, however the filtering does not seem to be working and I can see all call histories regardless of the person I choose. I've done this before and I must be missing something obvious.
I have verified the sessionScope.callHistoryID is being updated as I select a new person. My Call History db currently only has 2 history documents for one guest, yet they display for every guest in the Xpage.
sessionScope.callHistoryID from the debugger is obviously not the same (see below):
<xp:panel id="pnlCallHistoryModal" style="padding-bottom:20px">
<xp:this.data>
<xp:dominoView var="callhistoryView"
viewName="luCallHistorybyPaxandIncidentID"
databaseName="blah.nsf"
ignoreRequestParams="true"
categoryFilter="#{javascript:sessionScope.callHistoryID}">
</xp:dominoView>
</xp:this.data>
<div class="col-xs-12 col-md-12 col-lg-12 panel-body">
<xp:repeat id="repeat1" value="#{callhistoryView}"
var="viewRow" indexVar="rowIndex" rows="500"
repeatControls="false">
<xp:this.facets>
<xp:text disableTheme="true" xp:key="header"
escape="false">
<xp:this.value><![CDATA[
<table class="table table-hover">
<tbody>]]></xp:this.value>
</xp:text>
<xp:text disableTheme="true" xp:key="footer"
escape="false">
<xp:this.value><![CDATA[
</tbody>
</table>]]></xp:this.value>
</xp:text>
</xp:this.facets>
<xp:tr>
<xp:this.rendered><![CDATA[# {javascript:if(viewRow.isCategory()){
return false
}else{
return true
}}]]></xp:this.rendered>
<xp:td styleClass="col-md-10 col-lg-10 small">
<xp:text escape="true" id="name">
<xp:this.value><![CDATA[#{javascript:#ProperCase(viewRow.getColumnValue("CallerFullName"))}]]></xp:this.value>
</xp:text>
<br></br>
<xp:text escape="true" id="computedField1"
styleClass="small secondary-text">
<xp:this.value><![CDATA[#{javascript:if(viewRow.getColumnValue("CallerMemo").length > 128){
return viewRow.getColumnValue("CallerMemo").substring(0,128) + " ..."
}else{
return viewRow.getColumnValue("CallerMemo")
}}]]></xp:this.value>
</xp:text>
</xp:td>
<xp:td styleClass="col-md-2 col-lg-2 small">
<xp:text escape="true" id="creationdatetime"
styleClass="small">
<xp:this.value><![CDATA[#{javascript:viewRow.getColumnValue("CallDateTime")}]]></xp:this.value>
<xp:this.converter>
<xp:convertDateTime type="both"
dateStyle="short" timeStyle="short">
</xp:convertDateTime>
</xp:this.converter>
</xp:text>
</xp:td>
</xp:tr>
</xp:repeat>
</div>
</xp:panel>

I suspect this will be doing the equivalent of ViewNavigator.createViewNavFromCategory(). It's worth checking how that acts if the category name doesn't exist. It may fall back to a partial match.
For "restrict to category", you might be better placed using the keys property and settings keysExactMatch to true.

Related

MultipleField Value in repeat Control with Pager

what i want to do is If a field has more than 20 values How can i list values in a repeat control with pager component and editBox or computedField.
Only 20 records should be listed for per page. a Pager should help me to show all values page by page..
this field is listed in a dialogBox. here is the my Code below. If someoen did it and it is possible to share it. Appreciate that..
<xe:dialog id="dialogHistory" title="Tarihçe">
<xp:panel>
<xp:pager id="pager1" for="repeat1">
<xp:pagerControl type="First" id="pagerControl1"></xp:pagerControl>
<xp:pagerControl type="Previous" id="pagerControl2"></xp:pagerControl>
<xp:pagerControl type="Group" id="pagerControl3"></xp:pagerControl>
<xp:pagerControl type="Next" id="pagerControl4"></xp:pagerControl>
<xp:pagerControl type="Last" id="pagerControl5"></xp:pagerControl>
</xp:pager>
<xp:repeat id="repeat1" rows="1" first="1" var="col" indexVar="index">
<xp:this.value><![CDATA[#{javascript:var cVal = document1.getValue("history"); return cVal;}]]></xp:this.value>
<xp:inputText id="inputText1" multipleSeparator="#{javascript:#NewLine();}">
<xp:this.value><![CDATA[#{javascript:var cVal = document1.getValue("history");
return cVal;}]]>
</xp:this.value>
</xp:inputText>
</xp:repeat>
</xp:panel>
</xe:dialog>
The trouble is that you're referring back to the document, not the values of the field in the inputText.
<xp:repeat id="repeat1" rows="20" var="col" indexVar="index">
<xp:this.value><![CDATA[#{javascript:var cVal = document1.getValue("history"); return cVal;}]]></xp:this.value>
<xp:inputText id="inputText1" value="#{col}">
</xp:inputText>
</xp:repeat>
However, I think this will only display them in inputText. I don't think that it binds them to the field, so I don't think it would allow you to change the values.
Exactly according to the code,It is difficult to Point the issue but the same xpage code,If it would help you in any case.
Code:
<?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="testing">
</xp:dominoDocument>
</xp:this.data>
<xp:br></xp:br>
<xp:repeat id="dateRepeatControl" rows="5" var="r" indexVar="i"
first="0">
<xp:this.value><![CDATA[#{javascript:var v:java.util.Vector = new java.util.Vector();
v.add('Date1');v.add('Date2');v.add('Date3');v.add('Date4');v.add('Date5');v.add('Date6');
v.add('Date7');v.add('Date8');v.add('Date9');v.add('Date10');v.add('Date11');v.add('Date12');
;v.add('Date13');v.add('Date14');
return v;}]]></xp:this.value>
<xp:br></xp:br>
<xp:div id="checkDiv">
<xp:text escape="true" id="computedField1"
value="#{javascript:r}">
</xp:text>
</xp:div>
<xp:br></xp:br>
</xp:repeat>
<xp:pager partialRefresh="true" id="pager1"
for="dateRepeatControl">
<xp:pagerControl id="pagerControl1" type="First"></xp:pagerControl>
<xp:pagerControl id="pagerControl2" type="Previous"></xp:pagerControl>
<xp:pagerControl id="pagerControl3" type="Next"></xp:pagerControl>
<xp:pagerControl id="pagerControl4" type="Last"></xp:pagerControl>
<xp:pagerControl id="pagerControl5" type="Separator"></xp:pagerControl>
</xp:pager>
</xp:view>
This is an xpage having a repeat control with 5 values of a vector to be repeated at one page and pages helps it to go next.You can use this xpage to get the working repeat control with the pager.

Xpages: make tables with all fixed cells but last

I am having trouble understanding why I cannot control tables in Xpages in general and in HTML in particular.
I want some cells to have a fixed-width. For example, my first column in the table I am working on is a checkbox, so there is zero reason the width should ever change. The second column has two images that can be different but the width is always going to be the same. I HATE it when the size of these columns moves all around, as it looks bad.
Ideally I would like to be able to specify which cells are fixed and which are resizable, but if I cannot do that I want a table with every cell fixed except the last one.
Any suggestion on how to do this would be greatly appreciated.
David is correct, I should have added code. I am doing so now.
The code below is a repeat that generally dos what I want it to do. I am very happy for any suggestions to improve it or make it more flexible.
<?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">
<xp:this.data>
<xp:dominoView
var="view1"
viewName="(xpAllPCBuilds)" />
</xp:this.data>
<xp:this.resources>
<xp:styleSheet
href="/custom.css" />
</xp:this.resources>
<xe:firebugLite
id="firebugLite1" />
<xe:widgetContainer
id="widgetContainerView"
style="width:99.00%">
<xp:panel>
<xp:repeat
id="repeat1"
var="rowData"
indexVar="repeatIndex"
value="#{view1}">
<xp:this.facets>
<xp:text
disableTheme="true"
xp:key="header"
escape="false">
<xp:this.value><![CDATA[<table class='lotusTable repeatRowColors' border='0' cellspacing='0' cellpadding='0'>
<tr class ='lotusFirst lotusSort scope='col'>
<th>Employee Name</th>
<th>Computer</th>
<th>Create Date</th>
<th>Create User</th>
<th>ID</th>
</tr>
</thead>]]>
</xp:this.value>
</xp:text>
<xp:text
disableTheme="true"
xp:key="footer"
escape="false">
<xp:this.value>
<![CDATA[</table>]]></xp:this.value>
</xp:text>
</xp:this.facets>
<xp:this.rows><![CDATA[#{javascript:var rows:Integere = viewScope.get("rows");
if (rows == null)
{return 5}
else
{return rows}}]]></xp:this.rows>
<xp:tr
id="rowDataContainer">
<xp:td
style="width:200px;min-width:200px;max-width: 200pxx">
<xp:link
escape="true"
id="link1"
value="">
<xp:this.text><![CDATA[#{javascript:rowData.getColumnValue("employeeName")}]]></xp:this.text>
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="complete">
<xp:this.action>
<xp:openPage
name="xpFormPCBuild.xsp"
target="openDocument">
<xp:this.documentId><![CDATA[#{javascript:rowData.getDocument().getUniversalID()}]]></xp:this.documentId>
</xp:openPage>
</xp:this.action>
</xp:eventHandler>
</xp:link>
</xp:td>
<xp:td
style="width:50px;min-width:50px;max-width: 50px">
<xp:text
escape="true"
id="computedField2">
<xp:this.value><![CDATA[#{javascript:rowData.getColumnValue("computerName");}]]>
</xp:this.value>
</xp:text>
</xp:td>
<xp:td
style="width:75px;min-width:75px;max-width: 75px">
<xp:text
escape="true"
id="computedField3">
<xp:this.value><![CDATA[#{javascript:rowData.getColumnValue("CrtDte");}]]>
</xp:this.value>
</xp:text>
</xp:td>
<xp:td
style="width:200px;min-width:200px;max-width: 200px">
<xp:text
escape="true"
id="computedField4">
<xp:this.value><![CDATA[#{javascript:rowData.getColumnValue("crtUsr");}]]>
</xp:this.value>
</xp:text>
</xp:td>
<xp:td>
<xp:text
escape="true"
id="computedField5">
<xp:this.value><![CDATA[#{javascript:rowData.getColumnValue("ID")}]]></xp:this.value>
</xp:text>
</xp:td>
</xp:tr>
</xp:repeat>
</xp:panel>
</xe:widgetContainer>
</xp:view>
If you are using xp:table you can insert some HTML inside the xp:table container:
a colgroup (http://www.w3schools.com/tags/tag_colgroup.asp). With that you can control your column widhts with CSS e.g. style="width:200px"

Xpages Binding to edit control in a repeat

I'm a problem understanding how to do dynamic binding to a edit control. The backend from has fields fItem01 fItem02... fPD01 fPD02.. fRQR01 fRQR02.. I can get the values for all the fields but having been able to defined the binding for edit control.
I've read all the posting on this subject but haven't figure out what I'm doing wrong.
Also tried using a custom control with a property for the binding but that didn't work either.
Thanks for any help on this
Bob
<xp:this.data>
<xp:dominoView var="view1" viewName="vwMultItem"></xp:dominoView>
</xp:this.data>
<xp:table border="1">
<xp:tr>
<xp:td>
<xp:label value="Title" id="label1"></xp:label>
</xp:td>
<!--<xp:td></xp:td>-->
</xp:tr>
<xp:repeat id="repeat1" rows="1" value="#{view1}" var="row">
<xp:panel id="panelDocData">
<xp:this.data>
<xp:dominoDocument var="document1"
formName="frMultItem" action="editDocument"
documentId="#{javascript:row.getNoteID();}">
</xp:dominoDocument>
</xp:this.data>
<xp:repeat id="repeat2" rows="3" var="rowItem" first="0"
indexVar="indexVar">
<xp:this.value><![CDATA[#{javascript:new Array("01", "02", "03")}]]></xp:this.value>
<xp:tr>
<xp:repeat id="repeat3" first="0" rows="2"
var="rowName">
<xp:this.value><![CDATA[#{javascript:new Array("fItem","fPD")}]]></xp:this.value>
<xp:td>
<xp:text escape="true" id="computedField1">
<xp:this.value><![CDATA[#{javascript:document1.getItemValueString(rowName+rowItem);
}]]></xp:this.value> </xp:text>
</xp:td>
</xp:repeat>
<xp:td>
<xp:inputText id="inputText1"
value="#{javascript:'#{document1.fRQR'+'01'+'}'}">
</xp:inputText></xp:td>
</xp:tr>
</xp:repeat>
</xp:panel>
</xp:repeat>
</xp:table>
As you know which fields you want to put into the repeat control you can calculate the fieldNames in inner repeat block completely with
javascript:["fItem"+rowItem,"fPD"+rowItem,"fRQR"+rowItem]
and then use them in edit control's value EL #{document1[fieldName]}.
<xp:repeat
id="repeat2"
var="rowItem"
indexVar="indexVar">
<xp:this.value><![CDATA[#{javascript:["01", "02", "03"]}]]></xp:this.value>
<xp:tr>
<xp:repeat
id="repeat3"
var="fieldName">
<xp:this.value><![CDATA[#{javascript:["fItem"+rowItem,"fPD"+rowItem,"fRQR"+rowItem]}]]></xp:this.value>
<xp:td>
<xp:inputText
id="inputText2"
value="#{document1[fieldName]}">
</xp:inputText>
</xp:td>
</xp:repeat>
</xp:tr>
</xp:repeat>

Show only Unread document current View?

anyone have a suggest to realize #Command([ViewShowOnlyUnread]) in XPages ViewPanel?
And is possibile realize the function "Next Unread" and "Previus Unread"?
Instead of binding the view panel to a standard view data source, try setting its value attribute to the following expression:
importPackage(com.ibm.xsp.model.domino);
var targetView = database.getView("Some View");
var unreadEntries = targetView.getAllUnreadEntries();
var unreadModel = new DominoViewEntryCollectionDataModel(unreadEntries);
return unreadModel;
The view panel should then behave exactly as it would if it were bound to a true data source, but only display the unread entries.
Excellent answer from Tim..
Here's other version with Repeat Controls -
<xp:repeat id="repeatUnreadEntries" var="viewEntry" indexVar="index" rows="30">
<xp:this.value><![CDATA[#{javascript: return database.getView('viewName').getAllUnreadEntries()}]]></xp:this.value>
<xp:this.facets>
<xp:panel id="repeatHeader" xp:key="header">
<xp:text disableTheme="true" escape="false">
<xp:this.value>
<![CDATA[<TABLE><THEAD><TH>Cell1</TH><TH>Cell2</TH></THEAD><TBODY>]]>
</xp:this.value>
</xp:text>
</xp:panel>
<xp:panel id="repeatFooter" xp:key="footer">
<xp:text disableTheme="true" escape="false">
<xp:this.value><![CDATA[</TBODY></TABLE>]]></xp:this.value>
</xp:text>
</xp:panel>
</xp:this.facets>
<TR>
<xp:repeat var="entryColVal" indexVar="colIndex" value="#{javascript:viewEntry.getColumnValues()}">
<TD>
<xp:text value="#{entryColVal}" />
</TD>
</xp:repeat>
</TR>
</xp:repeat>
The code provided by Tim Works if you set data and value attributes to view panel, like below.
<xp:viewPanel rows="30" id="viewPanel1">
<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="vwSrc"></xp:dominoView>
</xp:this.data>
<xp:this.value><![CDATA[#{javascript:importPackage(com.ibm.xsp.model.domino);
var targetView = database.getView("vwSrc");
var unreadEntries = targetView.getAllUnreadEntries();
var unreadModel = new DominoViewEntryCollectionDataModel(unreadEntries);
return unreadModel();}]]></xp:this.value>
<xp:viewColumn columnName="col1" id="viewColumn1">
<xp:viewColumnHeader value="Column1" id="viewColumnHeader1"></xp:viewColumnHeader>
</xp:viewColumn>
</xp:viewPanel>

Xpages document data not visible in NOTES client

X-pages document data not visible in NOTES client but is working perfectly in the browser.
There is test page, where I have a repeat control, ignores the data in Notes Client and In browser it works perfect,
below are the images.
Notes output.
Browser output
In the above images the first image is of notes client and 2nd one is of browser.
Just to verify, I have passed the "View" in the page and the "view" is shown properly in both browser and notes clients.When I written the below exam code to just retrieve the data in test page using the repeat control, The issue is clear in images,
Any suggestion will be appreciated.Thank you.
Edit 1: Source Code ( Have just updated the images for this test)
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:div align="center">
<xp:table style="width:50%;text-align:center">
<xp:tr>
<xp:td>
<xp:label value="ID" id="label1"></xp:label>
</xp:td>
<xp:td>
<xp:label value="FORM" id="label2"></xp:label>
</xp:td>
</xp:tr>
<xp:repeat id="crepeat1" rows="30" var="c" indexVar="i">
<xp:this.value><![CDATA[#{javascript:var v:NotesView = database.getView("all_open_events");
var category = #Name("[Abbreviate]",#UserName());
return v.getAllEntriesByKey(category);
}]]></xp:this.value>
<xp:tr>
<xp:td>
<xp:text escape="true" id="computedField1">
<xp:this.value><![CDATA[#{javascript:return i +".";}]]></xp:this.value>
</xp:text>
</xp:td>
<xp:td>
<xp:text escape="true" id="computedField2">
<xp:this.value><![CDATA[#{javascript:var doc:NotesDocument = c.getDocument();
return doc.getItemValueString('form');}]]></xp:this.value>
</xp:text>
</xp:td>
</xp:tr>
</xp:repeat>
</xp:table>
</xp:div>
</xp:view>
Very common mistake: you do not specify server in data source. XPages from server work (current server), but for XPiNC you must specify server name or make a local replica of the database (XPages run on local).

Resources