XPages Open view and open XPage in edit mode - xpages

I've told a view to open using an XPage, but how do I open that XPage in edit mode?

I will suggest that you buy and read the Mastering XPages book to learn the basics of handling views and documents in XPages. The book contains material that describes exactly what you are looking for (how to open an XPage in read and edit mode).

I will assume your question relates to the XPage being used to open the selected document from the view and not the view itself as it is not possible to either define an XPage to to launch a view or for a view to be in "Edit Mode"...
When specifying the document data source for an XPage it is possible to define the default action as being Edit Document or Open Document. This sets the "action" property of the data source
The XPage itself has a "readonly" property that can be set to a specific value or computed. This is not tied to a specific data source.
It is possible to add a panel container control to the XPage and set the "readonly" property of the panel. This will allow all the controls inside the panel to be rendered as editable or readonly.

views and xpages cannot be in edit mode, only document data sources can be in edit mode.

In addition to the readonly properties that Peter mentioned:
It is possible that a custom control got its own data source while the one from a parent (e.g. the xpage) is in edit mode. That's the mistake i make often while binding controls to data fields.

Related

How to open a document in a dynamiccontent control facet from a viewpanel control

I have a dynamiccontent control on a XPage with a facet containing a custom control which has a viewpanel in it. I also have a second facet in the dynamiccontent control containing a custom control which is connected to a document data source.
What I am trying to figure out is when the viewpanel custom control is loaded in the dynamiccontent how do I get the links in the viewpanel custom control to load the dynamiccontent facet containing the custom control connected to the document data source and display the document?
I think the Dynamic Content example in the Extension Library Demo database is self explaining. It use also a view and a document
Well I'ver always found ViewPanels to be very limiting if you want to do anything fancy. I don't think you can easily use any of the built in features. I would personally use a Repeat Control and then have a button that takes the intended document and gets the unid. You can then put that unid into a viewScope variable, change your dynamic content control to the document facet and have that custom control get the unid from viewScope to get the correct document.
I long time ago I did a rather crappy demo that showed a couple of these techniques. https://www.youtube.com/watch?v=GSLAy6U2_3A
The CSS attempt failed there but you should be able to see a repeat control and putting the unid into scope etc. It might help you a little.

xpages Custom Control "fileDownload" don't display "modified file" in reader mode

I am using a "document library" (template: StdXLWebXDocLib). When I modify the Custom Control "fileDownload" and I put the <displayLastModified option = "true">, the modification date does not appear in Reader mode while it is displayed when i am in Edit mode.
Is this a XPAGES bug ? Anyone know the solution?
There are two different fileDownload control on that page, inside different facets of a dynamic content container. You should modify both.

Command Not Handled Exception

I'm new to Domino Designer. I'm trying to modify an existing application which is running on a remote server. I create a blank xPage and view in browser and it works. I add a label and view in browser and it works. I add a combo box and setup a data source for my xPage. The data source is in the current application and I'm using a view. I setup my combo to point to that data source and specify BindTo value. I view it in browser and I get Error 500 "HTTP Web Server: Command Not Handled Exception" I can open the view that I've used and see all the data in the view. I can even add, edit, and delete from the view.
Ideas... Thnxs in advance.
Additional Info. I've added a "View" from "Container Controls" and used the same data source and the same view and it also works in the browser.
The error being printed is:
javax.faces.el.PropertyNotFoundException: Error getting property 'CompanyName' from bean of type lotus.domino.local.View
com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:119)
com.ibm.xsp.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:144)
com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:182)
com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:163)
com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.j‌​ava:257)
com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:150) ....
This was already answered in the comments, but I want to write a better answer.
The problem in this case is that a view data source is being used for editing a document. Directly, this is not a possibility, though there are a few great ways to get around this. The first way, and my favorite, is to use an inline form. I think the Extension Library Demo database offers a few great examples of how to go about doing this. One way is to use a tooltip dialog. Another way is an inline form. A repeater is used and for every row in the view, a hidden panel can be made which contains the document data source and all field which are required to be changeable. By clicking on a button or link, the panel is made visible. This is my favorite variant because it is simple, quick, and generally looks great.
Another way to go about this is to have a view data source only, but use scripts to retrieve the document and set the values in the background and then save and release. It all depends on what you are trying to achieve.
My main recommendation is to look at the ExtLib demo and take a look at what they are doing there.

xpages extension Library dialog read only

Can the xpages extension library dialog box (xe:dialog) be open so that it's fields are read only ?
Lotus Domino 8.5.3 version update 1 extlib
Thanks
If you make a panel control read only, the controls within the panel control are read only too. So, add your fields inside a panel control and make it read only:
<xp:panel readonly="true">
Add your fields here
</xp:panel>
The content of the dialog is defined by the structures declared within it, so you'd just make your elements within the content area computed text, or readonly fields, however you want to do it. If your question is can it be opened read-only sometimes, save a variable to the scope and use that to determine whether or not to render controls as editable.

Why is my fileDownload control showing the trashcan even in read mode?

This is a rather strange one I think, and I'm sure I made a mistake here myself:
in one of my applications I'm showing a fileDownload control bound to a Richtext field in my underlying NotesDocument. The control's properties a are set to Hide if no attachments, show size, type and created as well as allow delete. The control itself sits inside a custom control, being part of another custom control, similar to this:
Xpage.xsp
- ccContainer
- - ccInnerDoc
Document datasources for both the container and the "inner" doc are defined at the root of ccContainer and passed into the inner doc.
The inner doc's datasource is comnputed based on a document selection, and it's igenoreRequestParams property is set to false so that I can display the contents of the selected datasource in a given panel etc.
The selected doc is first opened in read mode, and I can set it to edit mode using a button.
Problem now is that my file download control always is showing the delete icon (trashcan) no matter which mode the doc is opened in. And it's not only the icon showing, it also pretends to work by asking me whether I really want to delete and then really removes the file attachment. Only that this change of course cannot be stored into the datasource because it's only open in read mode.
I'm sure that this behaviour is some side-effect of something else in my application (to a certain extent I rebuilt this in a plain new db and until now cannot reproduce it), but I'm at the end of my knowledge of what this could be.
Any hint of what could be causing this is more than welcome.
In place of #Frantisek Kossuth I answer this myself: see compute dynamically the allowDelete property of file download xpages
Thanks again, Frantisek!

Resources