djextListTextBox Select all option in XPages - xpages

is it possible to add "Select All" and "Deselect All" I could not find how to manage that kind of problem ?
<xe:djextListTextBox id="FieldOne" value="#{document1.FieldOne}" rendered="#{javascript:document1.isEditable()}" multipleSeparator="," multipleTrim="true">
</xe:djextListTextBox>
<xe:valuePicker id="vPicIlgiDosyaSec"
for="FieldOne"
rendered="#{javascript:document1.isEditable()}"
dojoType="extlib.dijit.PickerCheckbox">
<xe:this.dataProvider>
<xe:simpleValuePicker
caseInsensitive="true">
<xe:this.valueList><![CDATA[#{javascript:
}]]></xe:this.valueList>
</xe:simpleValuePicker>
</xe:this.dataProvider>
</xe:valuePicker>

You could extend the Value Picker, but that's not going to be straightforward. Deselect All would be relatively straightforward code behind the scenes (get the for component and clear the value). Select All would have to take into account the wide variety of dataProviders, so would be considerable less straightforward.
The easiest option is to store your simpleValuePicker's options somewhere outside the picker itself, then add two buttons to your XPage, Select All would call document1.replaceItemValue("FieldOne",allVals), Deselect All would call document1.replaceItemValue("FIeldOne","").

Related

XPages Pager with Last and lots of pages

I am looking at a way to bypass a bug in the standard pager with views that contain a large numbers of documents. When I use the code below, the "Last" won't show up:
<xp:this.facets>
<xp:pager layout="First Previous Group Next Last" xp:key="header"
id="pager1" for="myView" partialRefresh="true">
</xp:pager>
Anyone got around this, or has an alternate solution?
Set the alwaysCalculateLast property on the xp:pager to true to calculate the last document in the view. There can be a performance hit when this is set to true, though.

How to get a sequential number of all the documents in a view

How to get a sequential number of all the documents in a view. The sequential numbers will appear in a column of a view. I have used #DocNumber but it does not work when I preview my View from xpage page.
See https://www-10.lotus.com/ldd/ddwiki.nsf/dx/List_of_Formula_Not_Supported_In_XPages. #DocNumber is not supported in XPages.
If you use viewPanel, there exists one simple solution.
Set the var property of your viewPanel to some meaningful name you like, e.g.
<xp:viewPanel var="viewEntry" ....etc....>
</xp:viewPanel>
By doing this, you provide yourself an explicit access to every iteration of DominoViewEntry (viewPanel uses it internally).
Then create a view column, don't set columnName property, set the value property. Like this:
<xp:viewColumn value="#{javascript:viewEntry.getPosition('.')}"
id="docNumberColumn">
<xp:viewColumnHeader value="Doc Number"
id="docNumberHeader">
</xp:viewColumnHeader>
</xp:viewColumn>
Sorry, no way to avoid SSJS here, because DominoViewEntry does not expose getPosition() method to its getValue() implementation, so we have to call it directly.
Update: this should work for dataTable and dataView as well, because all of them use UIDataIterator behind the scenes and both have var property.
Use repeat control and display the index number?

Can I prevent embedded view from putting a database on the workspace?

I have two databases, A and B. I want to surface a view from B into A. I can do this using an embedded view in an outline or a form and it works fine.
But I do not want database B put on a user's workspace. If I add it and the user opens a doc or opens the view, then it puts that db on the workspace.
Is there a way around this? What if I embed an Xpage?
That's a built-in behavior of Lotus Notes and unfortunately there's no way to turn that behavior off.
As an alternative you could write an Agent that pulls the data in from Database B into Database A, and then just display that data within a Database A view.
As Ken already said that it is a built-in behavior. You can try to programmatically remove the database icon. This Technote describes it.
#Command([AddDatabase]; "Server Name":"DatabaseB.nsf");
#Command([WindowWorkspace]);
#Command([FileDatabaseRemove]);
I haven't tried it myself, but you can put this code on close of form of embedded view. Also, its not possible to remove a database icon from the Notes client workspace using LotusScript, JavaScript, or Notes API.
It works as Naveen describes it. However, even if you manage to clean up the icon, in Notes there is a built-in fault when using an embedded view from another database.
The problem is -- you cannot use the traditional Notes templates because the link to the source database of the embedded view is hard-coded using the replicaid. So if you pull a template from your design and create a new database for production, the embedded view will still point to your test database.
I have used this configuration, but then each time you deploy a new template you need to modify design, so that it points to the correct database. It can be programmed for example by using DXL export/import but is not a trivial Notes deployment any more.
Multiple options here: computed text to display the contents of the view using HTML, creating an Xpage that displays the view, or some AJAX to get the data and display in HTML.
Computed text to display the view
This is relatively simple. Add computed text, set to use pass-through HTML, that does a DbColumn on a new view in the source database. Either add a hidden column at the end of the existing view or create a new, single column view that has the HTML for a single row in the view.
For the computed text, just a simple formula:
"<table>" + #DbColumn( "Notes" : "NoCache" ; "MyServer/Company" : "SourceDatabase.nsf" ; "HTMLview" ; 1) + "</table>"
Then, for the column formula, use something like this:
"<tr><td>" + PartName + "</td><td>" + PartNumber + "</td><td>" + Price + "</td></tr>"
XPage for view
Just create the XPage with a simple view, like this:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<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="COPApprovals"></xp:dominoView>
</xp:this.data>
<xp:viewColumn columnName="$11" id="viewColumn1" style="font-weight:bold;color:rgb(0,0,160)">
</xp:viewColumn>
<xp:viewColumn columnName="$10" id="viewColumn2" style="font-weight:bold;color:rgb(0,64,0)">
</xp:viewColumn>
<xp:viewcolumn columnName="$12" id="viewColumn3">
</xp:viewColumn>
</xp:viewPanel>
</xp:view>
AJAX
A good intro to using AJAX to display Notes data can be found in Scott Good's AJAX name-picker. I've built a number of views and picklists using that format. The laptop that has the modified designs is on the fritz right now. If I get access again, I will post samples.
Hope you get some ideas there.

Setting "title" attribute on <xp:selectItem> in a Combo Box

I have a combo box with descriptions that are long in length. I'm trying to find the best way to show the full description. One thing I came across was the title attribute which causes a popup to show on hover. I tried to use the "attrs" property in XPages to add a title property, but xp:selectItem and xp:selectItems "attrs" do not appear in the HTML output.
Anyone have any ideas or a different method to try? Thanks for any thoughts.
EDIT: I ended up changing the combo box into a dialog pick list. This satisfied my requirements.
Did you consider using xe:djComboBox from Extension Library?
See http://www-10.lotus.com/ldd/ddwiki.nsf/dx/djComboBox_Dojo_Combo_Box_ddxl853
<xe:djComboBox id="djComboBox1" value="#{sessionScope.djComboBox1}"
tooltipPosition="auto">
<xe:this.dojoAttributes>
<xp:dojoAttribute name="autoComplete" value="false">
</xp:dojoAttribute>
<xp:dojoAttribute name="labelType" value="html">
</xp:dojoAttribute>
</xe:this.dojoAttributes>
<xp:selectItems>
<xp:this.value>
<![CDATA[#{javascript:return new Array("<b>Apples</b>|apples", "Oranges|oranges")}]]>
</xp:this.value>
</xp:selectItems>
</xe:djComboBox>
Each element in array should have following format "label|value|description|disabled", where only label is mandatory. See: http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=%2Fcom.ibm.designer.domino.ui.doc%2Fwpd_controls_cref_selectitems.html
If the description of your items is so long that they dont fit in a combobox you could either:
Change the length of the combobox using css.
Retrieve the description and only display a portion of it (lets say first 100 chars ).
Descriptions in comboboxes should be 'descriptive' ( hence the word description ). I would go for the second approach and add something in front of the description so the description is still usefull for the users.
For instance when have a list of projects. These titles are 100+ characters long. Instead of displaying the full description. Cut them of and use the project code as a prefix so that it will display
ProjectCode - {first 100 chars of description}.
This way users still know what they select because of the project code.

Xpages MobileControls and Categorized View

I have downloaded the Xpages mobile Controls from Openntf
and had a problem with the categorized view
I've used the ViewWithCategoriesAndDocument example to show a View with one Category this works fine.
But how do I use a View with multiple Categories?
has someone a Idea?
Are you using 853 and Upgrade Pack 1 that'll give you the Extlib controls along with the new Mobile controls?
If so, use a Data View in a Mobile Page control. There you can add the multiple categories along with a summary and the mobile theme will take care of the rest.
<xe:dataView id="dataView2" pageName="#p03"
openDocAsReadonly="true">
<xe:this.data>
<xp:dominoView var="dominoView1" viewName="yourMultiCategorizedView" expandLevel="1"></xp:dominoView>
</xe:this.data>
<xe:this.summaryColumn>
<xe:viewSummaryColumn columnName="Topic"></xe:viewSummaryColumn>
</xe:this.summaryColumn>
<xe:this.categoryColumn>
<xe:viewCategoryColumn columnName="parentCategory"></xe:viewCategoryColumn>
<xe:viewCategoryColumn columnName="subCategory"></xe:viewCategoryColumn></xe:this.categoryColumn>
</xe:dataView>
Note in the above snippet that expandLevel="1" - this will collapse all the categorized views and make each category and subcategory selectable to expand those rows.
Note that expandLevel="1" doesn't always work right. See
https://www-304.ibm.com/support/entdocview.wss?uid=swg1LO58079
I wasted almost a day trying to get this one to work before I found out.

Resources