I've been following Dave's Notesin9 video on full text searching.
My source code is:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
defaultLinkTarget="_blank">
<xp:br></xp:br>
<xp:inputText id="inputText1" value="#{requestScope.variant}"></xp:inputText>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:text escape="true" id="computedField1" value="#{javascript:requestScope.variant}"></xp:text>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:button id="button3" value="Search"><xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="false" save="true"></xp:eventHandler></xp:button>
<xp:br></xp:br>
<xp:viewPanel id="viewPanel1" pageName="/p_form.xsp" rows="20">
<xp:this.facets>
<xp:pager partialRefresh="true" layout="Previous Group Next"
xp:key="headerPager" id="pager1" style="width:40.0px">
</xp:pager>
<xp:viewTitle xp:key="viewTitle" id="viewTitle1"
value="List of documents"
style="width:153.0px;background-color:rgb(64,128,128);color:rgb(255,255,0)">
</xp:viewTitle>
</xp:this.facets>
<xp:this.data>
<xp:dominoView var="view1" viewName="vijay"
search="#{javascript:requestScope.variant}">
</xp:dominoView>
</xp:this.data>
<xp:viewColumn columnName="name" id="viewColumn1"
showCheckbox="true" displayAs="link">
<xp:viewColumnHeader value="name" id="viewColumnHeader1"
style="background-color:rgb(192,192,192)">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="age" id="viewColumn2">
<xp:viewColumnHeader value="age" id="viewColumnHeader2"
style="background-color:rgb(192,192,192)">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="email" id="viewColumn3">
<xp:viewColumnHeader value="email" id="viewColumnHeader3"
style="background-color:rgb(192,192,192)">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn id="viewColumn4" style="width:89.0px"
displayAs="link" columnName="$6">
<xp:this.facets>
<xp:viewColumnHeader xp:key="header"
id="viewColumnHeader4" value="Attch">
</xp:viewColumnHeader>
</xp:this.facets>
</xp:viewColumn>
</xp:viewPanel>
<xp:button value="New Topic" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action>
<xp:openPage target="newDocument" name="/p_form.xsp"></xp:openPage>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Delete selected" id="button2">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action>
<xp:deleteSelectedDocuments view="viewPanel1"
message="Are you sure to delete it('em)?">
</xp:deleteSelectedDocuments>
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>
here, included a textfield to input the search term,
computed field to view the queried term,
a button labelled search as a submit button.
Entered value in the textfield and
when i press the search button, i get error 500.
Where lies the mistake?
Pls help.
Naveen's almost certainly spot on, that the database is not full text indexed. Check the \data\IBM_TECHNICAL_SUPPORT folder on the server, for the latest modified file starting xpages_exc_###. This will give the full detailed error, including the stack trace. The XPages Log Reader project on OpenNTF can be used to view those files from a browser.
I'd recommend using sessionScope instead of requestScope for the search value. If you use requestScope, it's only available during that partial refresh. So when the user uses a pager or opens a document and goes back to the view, the requestScope variable is null again, so the search criteria are lost.
Related
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.
My underlying view is sorted on the categorized column. I have selected this column to sort on. There is not really a column header in the view for a category.
Any way around this? Maybe put a button that would switch the sort programmatically?
<xe:dataView
id="dataView1"
style="margin-top:55.0px"
openDocAsReadonly="true"
var="entry"
rows="25"
columnTitles="true"
showCheckbox="true"
showHeaderCheckbox="true">
<xe:this.data>
<xp:dominoView var="view1"
databaseName="scoApps\Spectrum\cashmarkData.nsf"
viewName="(view01)"
search="#{javascript:return sessionScope.searchString}"
sortColumn="author" />
</xe:this.data>
<xe:this.summaryColumn>
<xe:viewSummaryColumn
columnName="subject"
columnTitle="Subject" />
</xe:this.summaryColumn>
<xe:this.categoryColumn>
<xe:viewCategoryColumn
columnName="author"
columnTitle="Author"
style="font-weight:bold;font-size:14pt" />
</xe:this.categoryColumn>
<xe:this.extraColumns>
<xe:viewExtraColumn
columnTitle="Date Created"
columnName="creationDate"
headerStyleClass="xspDataViewColumn150"
styleClass="xspDataViewColumn150" />
</xe:this.extraColumns>
<xp:this.facets>
<xe:pagerExpand
id="pagerExpand1"
xp:key="pagerTopLeft"
partialExecute="true"
partialRefresh="true"
for="dataView1">
</xe:pagerExpand>
<xp:pager
layout="Previous Group Next"
partialRefresh="true"
id="pager1"
xp:key="pagerBottomLeft"
partialExecute="true" />
<xp:scriptBlock id="scriptBlock2"
xp:key="pagerBottom">
<xp:this.value><![CDATA[$("table.dataview").addClass("table-striped table-hover table-bordered table-condensed")]]></xp:this.value>
</xp:scriptBlock>
</xp:this.facets>
</xe:dataView>
I have done it before with a DataTable. In my column I set the sort column via a link
<xp:column id="column9">
<xp:this.facets>
<xp:div id="div8" xp:key="header" styleClass="team">
<xp:link escape="true" text="Team" id="link7" styleClass="sort">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="dataTablePanel">
<xp:this.action>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:viewScope.sortColumn = "Team"}]]></xp:this.script>
</xp:executeScript>
</xp:this.action>
</xp:eventHandler>
</xp:link>
</xp:div>
</xp:this.facets>
<xp:text escape="true" id="computedField14">
<xp:this.value><![CDATA[#{javascript:entry.getColumnValue("Team")}]]></xp:this.value>
</xp:text>
</xp:column>
And in my DominoView datasource I compute the sortColumn by
sortColumn="#{javascript:viewScope.get("sortColumn")}"
The refreshId point to a panel around my DataTable
I have an xe:dialog control on my xpage, with a view contol as a sort of picklist. The view shows entries of the current db. It's in a custom control, which is embedded in
A) an xpage with data of the current database,
B) an xpage with 2 data sources, doc1 is from a different db, doc2 is from the current db.
When I open (show) the dialog in case B), the view is always empty. The xpage B) is opened from a view of the different db.
the dialog code:
<xe:dialog id="diaSnippet" title="Textbaustein auswählen">
<xp:panel>
<xe:dialogContent id="dialogContent1">
<xp:panel>
<xp:inputText id="viwStartkey1"
value="#{viewScope.viwStartkey}">
</xp:inputText>
<xp:button iconAlt="Starts with" icon="/Search" id="bviwStartkey">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="viwOrgDB1">
</xp:eventHandler>
</xp:button>
<xp:viewPanel rows="30" id="viwOrgDB1" var="kbEntry">
<xp:this.facets>
<xp:pager partialRefresh="true" layout="Previous Group Next"
xp:key="headerPager" id="pager2">
</xp:pager>
</xp:this.facets>
<xp:this.data>
<xp:dominoView var="view1"
startKeys="#{javascript:if (hasContent(viewScope.viwStartkey)) viewScope.viwStartkey}"
keys="#{javascript:viewScope.UpdateField}" keysExactMatch="true"
viewName="lookupSnippet" databaseName="xpages\chhp1017.nsf">
</xp:dominoView>
</xp:this.data>
<xp:viewColumn columnName="ID" id="viewColumn1"
displayAs="link" openDocAsReadonly="true">
<xp:viewColumnHeader value="Kurzbez."
id="viewColumnHeader1">
</xp:viewColumnHeader>
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:var mySnippet = kbEntry.getColumnValue("Snippet");
fback.replaceItemValue(viewScope.UpdateField,mySnippet)
getComponent("diaSnippet").hide(viewScope.UpdateField + "1");
</xp:eventHandler>
</xp:viewColumn>
<xp:viewColumn columnName="Snippet" id="viewColumn2">
<xp:viewColumnHeader value="Textbaustein"
id="viewColumnHeader2">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="Comment" id="viewColumn3">
<xp:viewColumnHeader value="Kommentar"
id="viewColumnHeader3">
</xp:viewColumnHeader>
</xp:viewColumn>
</xp:viewPanel>
</xp:panel>
</xe:dialogContent>
<xe:dialogButtonBar id="dialogButtonBar1">
<xp:panel>
<xp:button id="button3" value="OK">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action>
<xp:actionGroup>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:getComponent("diaSnippet").hide()}]]></xp:this.script>
</xp:executeScript>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:panel>
</xe:dialogButtonBar>
</xp:panel>
<xp:eventHandler event="onHide" submit="true"
refreshMode="norefresh">
</xp:eventHandler>
</xe:dialog>
I tried a few things with the data source of the dominoView, current db, chosen db like in my code above, computed db path, but all with the same result.
Looks for me as if the dialog only works when "everything" is from the current db.
Thanks in advance, Uwe
Maybe it's of any interest ....:
We found the reason: The data definition of the view was missing the
ignoreRequestParams="true"
that does the trick.
I am using this Ext Lib (8.5.2) custom controls viewpanel, pager save state and dyanmic content. Does pager save state works with View panel.
If yes, pls look at my code here. I do not know why it is not working.
I am in the learning curve of xpages.
Thank you in advance.
Jason
This my custom control
<xe:pagerSaveState id="pagerSaveState1" globalRows="true"
for="viewPanel1">
</xe:pagerSaveState>
<xp:this.resources>
<xp:styleSheet href="/tablelayout.css"></xp:styleSheet>
</xp:this.resources>
<xe:dynamicContent id="dynContent" defaultFacet="viewpnl"
useHash="true">
<xe:this.facets>
<xp:panel xp:key="viewpnl" id="viewpnl">
<xp:viewPanel rows="30" id="viewPanel1" var="rowData"
columnClasses="evencol,oddcol" rowClasses="evenrow,oddrow"
binding="#{javascript:viewStateBean.restoreState}">
<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"
categoryFilter="#{javascript:sessionScope.searchValue}"
expandLevel="1" viewName="#{javascript:viewScope.vName}">
</xp:dominoView>
</xp:this.data>
<xp:viewColumn columnName="Urgency" id="viewColumn1"
expandedImage="/Collapse+Icon" collapsedImage="/Expand+Icon">
<xp:viewColumnHeader value="Urgency" id="viewColumnHeader1">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="From1" id="viewColumn2"
displayAs="link">
<xp:viewColumnHeader value="From" id="viewColumnHeader2">
</xp:viewColumnHeader>
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action>
<xp:actionGroup>
<xp:executeScript
script="#{javascript:viewScope.docUnid = rowData.getNoteID();}">
</xp:executeScript>
<xe:changeDynamicContentAction
facetName="form1" for="dynContent">
</xe:changeDynamicContentAction>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:viewColumn>
<xp:viewColumn columnName="SubDateTime" id="viewColumn3">
<xp:this.converter>
<xp:convertDateTime type="both" timeStyle="short">
</xp:convertDateTime>
</xp:this.converter>
<xp:viewColumnHeader value="Time of Call" id="viewColumnHeader3">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="Category" id="viewColumn4">
<xp:viewColumnHeader value="Category" id="viewColumnHeader4">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="JobStatus" id="viewColumn5">
<xp:viewColumnHeader value="Status" id="viewColumnHeader5">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn id="viewColumn6">
<xp:this.value><![CDATA[#{javascript:if (rowData.isCategory()){return rowData.getColumnValue("Total")
}}]]></xp:this.value>
<xp:this.converter>
<xp:convertNumber type="number" integerOnly="true">
</xp:convertNumber>
</xp:this.converter>
<xp:viewColumnHeader id="viewColumnHeader6"
value="Total">
</xp:viewColumnHeader>
</xp:viewColumn>
</xp:viewPanel>
</xp:panel>
<xc:xp_serviceRequestform xp:key="form1"></xc:xp_serviceRequestform>
</xe:this.facets>
</xe:dynamicContent>
This is the form cancel button
<xp:button value="Cancel" id="cancelbut">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete" immediate="true" save="false">
<xp:this.action>
<xp:actionGroup>
<xe:changeDynamicContentAction
facetName="viewpnl" for="dynContent">
</xe:changeDynamicContentAction>
<xp:executeScript
script="#{javascript:viewStateBean.restoreState = true}">
</xp:executeScript>
</xp:actionGroup>
</xp:this.action></xp:eventHandler>
I have an xPage with 2 datasources. I open the page and the first datasource is readonly, while the second datasource is in edit mode. Adding ignoreRequestParms=true seems to cause this behavior, but its the only way that the document will save to a different datasource.
I have found this link that someone has found similar behavior.
http://www-10.lotus.com/ldd/nd85forum.nsf/7756aedc25e6d81285256324005ac76c/5e2f855ea18ff802852576e3007c34f2?OpenDocument
There is something going on that I don't understand. If someone could explain this to me I would appreciate it.
Here is the code for the data source and the fields in the tab panel
<xp:dominoDocument var="document2" action="createDocument"
formName="software" ignoreRequestParams="true">
</xp:dominoDocument>
<xp:tabbedPanel id="tabbedPanel1">
<xp:tabPanel id="tabPanel1" label="Checklist Items">
<xp:checkBoxGroup id="checkBoxGroup1" layout="pageDirection"
value="#{document1.checklist}">
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:var dbName = new Array("","");
var Rep = #Unique(#DbColumn(dbName,"checklistitems",3));
Rep}]]></xp:this.value>
</xp:selectItems>
</xp:checkBoxGroup>
</xp:tabPanel>
<xp:tabPanel label="Software" id="tabPanel2">
<xp:button value="Edit Software list" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="panelsoft">
<xp:this.action>
<xp:changeDocumentMode mode="edit"
var="document2">
</xp:changeDocumentMode>
</xp:this.action></xp:eventHandler></xp:button>
<xp:button value="Save Software list" id="button2">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="panelsoft">
<xp:this.action>
<xp:actionGroup>
<xp:modifyField name="uid"
value="#{javascript:document1.getDocument().getUniversalID()}"
var="document2">
</xp:modifyField>
<xp:executeScript script="#{javascript:document2.save()}">
</xp:executeScript></xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:br></xp:br>
<xp:panel id="panelsoft"><xp:table rendered="#{javascript:document2.isEditable()}"><xp:tr><xp:td><xp:br></xp:br>
Software Name
</xp:td>
<xp:td>
<xp:inputText id="inputText1"
style="width:300px" value="#{document2.Softwarename}">
</xp:inputText></xp:td>
</xp:tr>
<xp:tr>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr>
</xp:table>
<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="view2" viewName="CustomSoftware"
categoryFilter="#{javascript:document1.getDocument().getUniversalID()}">
</xp:dominoView>
</xp:this.data>
<xp:viewColumn columnName="uid" id="viewColumn1">
<xp:viewColumnHeader value="uid"
id="viewColumnHeader1">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="Softwarename"
id="viewColumn2">
<xp:viewColumnHeader value="Software Name"
id="viewColumnHeader2">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="comments" id="viewColumn3">
<xp:viewColumnHeader value="Comments"
id="viewColumnHeader3">
</xp:viewColumnHeader>
</xp:viewColumn>
</xp:viewPanel>
</xp:panel>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:panel>
</xp:panel>
<xp:br></xp:br>
</xp:tabPanel>
</xp:tabbedPanel>
Because action is set to createDocument (which you could omit, since that's the default value), this causes a new document to be created in memory. This is why the document is in edit mode: you're composing a new record. If you don't want to create a new document, then change the action attribute to one of the other options: openDocument or editDocument. Either of these require that the documentId attribute be set as well, because the data source needs to know which document you wish to, respectively, open or edit.
If you omit the ignoreRequestParams attribute, then this data source doesn't ignore the URL request parameters. Instead, it looks for parameters named databaseName, formName, documentId, and action. If any of these parameters are included in the URL, the value of each overrides what is defined on the data source. This is why if you open an instance of document1, but don't set ignoreRequestParams on document2, then both documents will have the same mode (read/edit): because neither data source is ignoring the URL, so both data sources are doing what the URL is telling them to.
Generally, when defining multiple data sources on the same XPage, you'll have one that can be considered the "primary" data source; any other data has some relationship to that data, but the primary data is the user's context for viewing all the data on that page. So you want that data source to respect URL parameters to allow navigation (from a Data View, View Panel, Repeat, etc.) to be able to indicate which document is being opened, and in what mode. But all data sources related to that document should explicitly specify what data they're bound to, and the action being taken on that data, and use ignoreRequestParams to ensure that the URL doesn't override this information.