XPages Tag cloud - xpages

I would to show the tagcloud value individually in each line. Like a list
value1
value2
value3
...
...
..
This is my code. Everytime I choose a value from the list, the display list also got filtered.
This code work in XPNIC without a problem. In the browser I am having the problem as stated above.
<xp:section id="section2" header="Web" type="wide">
<xp:panel>
<xp:this.data>
<xp:dominoView var="view2" viewName="TagCloudActiveCategories" expandLevel="1">
</xp:dominoView>
</xp:this.data>
<xp:repeat id="repeat2" rows="30" value="#{view2}" indexVar="indexVar" var="rowData">
<xe:list id="list2" styleClass="lotusList">
<xp:link escape="true" id="link1" value="/allDocumentsByTag.xsp">
<xp:this.text><![CDATA[# {javascript:rowData.getColumnValues()[0];}]]></xp:this.text>
<xp:this.parameters>
<xp:parameter name="categoryFilter">
<xp:this.value><![CDATA[# {javascript:getComponent("link1").getText();}]]></xp:this.value>
</xp:parameter>
</xp:this.parameters>
<xp:eventHandler event="onclick" submit="true" refreshMode="norefresh"></xp:eventHandler>
</xp:link>
</xe:list>
</xp:repeat>
</xp:panel>
</xp:section>
Any help is very welcome. Thank you in advance.

As far I can see you are using URL parameters to filter your view. This parameter is used by EVERY view datasource on your XPage, even the datasource of your tag cloud.
Add the property ignoreRequestParams=true to your tag cloud view, this should solve the problem.
<xp:this.data>
<xp:dominoView var="view2" viewName="TagCloudActiveCategories" expandLevel="1" ignoreRequestParams="true">
</xp:dominoView>
</xp:this.data>

Related

xpages, save all documents in a repeat panel

I'm trying out a simple xpage that fetches a parent document (form fParent) and a few child documents (form fChild) via view vChildren. I can get the children as read only via a normal view control but these are read-only and I'd like to bind the children to documents so the save/submit button makes changes to both the parent and child documents.
In the repeat control, I'm binding the variable rowData to a DocumentCollection object which I'm assuming is iterated over and returns a Document object for each item (this seems to work as the xpage displays the correct number of custom controls). I understand from the HCL documentation that in order for the save action to be able to make changes to the child documents I need to add a document data source which I have done in the custom control.
The issue I have is that document2 in the custom control is picking up the parent form data and not the child form data (the note IDs for each child are the same as the parent which makes me think this is the case).
What am I doing wrong? Code below and thanks in advance.
xPage for the parent
<?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">
<xp:this.data>
<xp:dominoDocument formName="fParent" var="document1" />
<xp:dominoView
var="view1" viewName="vChildren"
categoryFilter="#{document1.Key}">
</xp:dominoView>
</xp:this.data>
Name
<xp:inputText id="inputText2" value="#{document1.Name}"></xp:inputText>
<xp:br></xp:br>
Key 
<xp:text escape="true" id="computedField1" value="#{document1['Key']}">
</xp:text>
<xp:br></xp:br>
<xp:repeat id="repeat1" rows="30" var="rowData">
<xp:this.value><![CDATA[#{javascript:
var key = currentDocument.getItemValueString("key");
return database.getView('vChildren').getAllDocumentsByKey(key);}
]]>
</xp:this.value>
<xc:ccChildDoc></xc:ccChildDoc>
</xp:repeat>
<xp:button id="button1" value="Save" save="true" type="submit"></xp:button>
</xp:view>
Custom control for each child document
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" binding="#{rowData}">
<xp:this.data>
<xp:dominoDocument
formName="fChild" var="document2"
action="editDocument" computeWithForm="both"
documentId="#{javascript:rowData.getNoteID();}">
</xp:dominoDocument>
</xp:this.data>
<xp:panel>
Note id: 
<xp:text escape="true" id="computedField1" value="#{javascript:document2.getNoteID();}">
</xp:text>
<xp:br></xp:br>
Comment 
<xp:inputText id="inputText1" value="#{document2.Comment}" readonly="false">
</xp:inputText>
<xp:br></xp:br>
Field2 
<xp:inputText id="inputText2" value="#{document2.Field2}" readonly="false">
</xp:inputText>
<xp:br></xp:br>
<hr />
</xp:panel>
</xp:view>
Try adding ignoreRequestParams="true" to your data source for the child document.
This parameter tells XPages to ignore the documentId parameter in the URL for the child document data source and the child data source should then use documentId="#{javascript:rowData.getNoteID();}".

XPage fileDownload1 control becomes editable on page full refresh?

Why fileDownload1 control becomes editable (delete file attachment icon appears next to fileDownload control) when I just refresh the page. Here is my code where I use a button to refresh the page (just for the example)
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete"></xp:eventHandler>
</xp:button>
<xp:this.data>
<xp:dominoDocument var="document1" formName="myXpage"
databaseName="${javascript:sessionScope.SUPPORT_DB_FILE}"
action="openDocument">
</xp:dominoDocument>
</xp:this.data>
<xp:fileDownload
id="fileDownload1"
rows="30"
displayLastModified="false"
displayType="false"
displayCreated="false"
hideWhen="true"
allowDelete="true"
value="#{document1.MyBodyRTF}">
</xp:fileDownload>
I tried to replicate what you're describing, but am having trouble doing so. I created a new XPage and modeled it after your sample code.
Notable differences:
I never see the trash icon
I had to compute the UNID of some document with an attachment in the appropriate field
I set both the DB name and UNID in beforePageLoad
I noticed an interesting change in the UI behavior (see animated gif below)
I'm not sure what you're running into without having more source code to be able to view, but I can confirm that what I tried doesn't reproduce the result you're describing.
XPage source:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.beforePageLoad><![CDATA[#{javascript:sessionScope.myDbName = database.getFilePath();
var vw:NotesView = database.getView("SomeForms");
var first:NotesDocument = vw.getFirstDocument();
sessionScope.myFirstDoc = first.getUniversalID();
first.recycle();
vw.recycle();}]]></xp:this.beforePageLoad>
<xp:this.data>
<xp:dominoDocument
var="document1"
action="openDocument"
formName="SomeForm"
databaseName="${javascript:return sessionScope.myDbName;}"
documentId="${javascript:return sessionScope.myFirstDoc;}" />
</xp:this.data>
<xp:fileDownload
rows="30"
id="fileDownload1"
displayLastModified="false"
value="#{document1.SomeAttachments}" />
<xp:button
value="Refresh"
id="button1">
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="complete" />
</xp:button>
</xp:view>

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.

xPage with multiple datasources has the second datasource always opened in edit mode

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.

Xpages Dynamic dojo dialog control

I have a list of products (created using a repeat control) and wish to click on a particular product and bring up a dialog with further information about that particular product. I don't really want to generate dijit.dialog thing for every single product on that page, so how can I do this dynamically possibly using AJAX and partial refresh.
A similar non xpages example can be seen here: http://www.replacementkeys.co.uk/window?dir=asc&limit=12&mode=grid&order=position - where you hover over an image and a quick view button comes up, which then dynamically loads the content for that product.
Any ideas would be truly appreciated.
We build the dialog outside the repeat control and then the action that launches or shows it also sets a viewScope variable that is used UNID for the data source in the dialog. Just make sure you refresh the contents of the dialog as you open it...
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:this.data>
<xp:dominoView var="promptView" viewName="dlgBoxes">
</xp:dominoView>
</xp:this.data>
<xp:panel>
<xp:repeat id="repeat1" rows="30" value="#{promptView}" var="promptEntry">
<xp:panel tagName="div">
<xp:text escape="true" id="computedField1" value="#{promptEntry.dlgName}">
</xp:text>
 
<xp:button value="details" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:
var pe:NotesViewEntry = promptEntry;
viewScope.put("dlgDocUnid", pe.getUniversalID());
getComponent("dialog1").show();
}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:panel>
</xp:repeat>
</xp:panel>
<xe:dialog id="dialog1" keepComponents="false" partialRefresh="true">
<xe:this.title><![CDATA[#{javascript:
var unid = viewScope.get("dlgDocUnid");
if(!unid) return "";
var doc:NotesDocument = database.getDocumentByUNID(unid);
return doc.getItemValueString("dlgName");}]]></xe:this.title>
<xp:panel>
<xp:this.data>
<xp:dominoDocument var="dlgDoc" formName="dlgBox" action="openDocument">
<xp:this.documentId><![CDATA[#{javascript:viewScope.get("dlgDocUnid");}]]></xp:this.documentId>
</xp:dominoDocument>
</xp:this.data>
<xp:text escape="true" id="computedField2" value="#{dlgDoc.Title}">
</xp:text>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:text escape="true" id="computedField3" value="#{dlgDoc.dlg}">
</xp:text>
</xp:panel>
</xe:dialog>
</xp:view>
Happy coding
/Newbs
You can combine your repeat control with the Extension Library dialog control in order to be able to launch a dialog when the user clicks on the individual row. Chris Toohey has created an excellent article called Popup Dialog Forms from Views in XPages that demonstrates this.

Resources