How can I use a custom control datasource (named doc) in XPage Application layout?
I need to control read mode and edit mode through the basic node of the place bar.
When I put the code doc.isEditable() in the rendered property, the following error is display in the browser:
Error while executing JavaScript computed expression
Script interpreter error, line=1, col=6: [ReferenceError] 'doc' not found
JavaScript code
doc.isEditable();
I am new to Xpage.
Can you post some code? not entirely sure what you mean.
Generally the best place to define a data source is at the top of the XPage so that every control beneath it has access to it. If your defining a data source after your trying to query it you would get an error like this
Related
I have a custom control with around 20 custom properties. However, some of these properties need to contain code logic. This is fine, as I create the property as Type: javax.faces.el.MethodBinding and Editor: Method Binding Editor which works fine.
However, once I close the editor, click somewhere else, then click back to the custom properties of my custom control, the code has disappeared. If I look at the source code however, the logic is visible. Its a little frustrating, as whenever I want to use the editor, I need to copy my code from the source and paste back into the editor (to help with formatting, showing errors as I type etc)
Has anyone else come across this and know how to fix it, or is this just another quirk of designer?
This image shows the empty property
This image shows the property has logic in the source code
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.java: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.
I'm currently building a custom control to be used as an application's view navigator (classic OneUI style). First of all: this is a 8.5.3 based project, and unfortunately there's no way to use Extlib stuff or other extensions / plug-ins. So we have to build all the tricky stuff ourselves using only what came "out-of-the-box" with 8.5.3.
I'd llike to build my navigator using a repeat control containing <xp:link> controls. Datasource could be an array of javascript objects where each single object would look like this:
var navEntry = {"entryLabel" : "label-of-link",
"entryTarget" : "target-url-of-link",
"entryStyle" : "style-to-emphasize-selected-link"}
Each array element then would describe a single navigator entry.
Since the navigator will be used in all possible "DominoView" Xpages it yould make sense to build the array of JS objects at the Xpage level and then pass that info into the custom control.
I'm aware that there are multiple ways to do this, and one could be "Custom Control Properties". If there was a way to pass my JS object array.
(Hope I could make clear what I'm trying to do here...)
That object looks like a HashMap to me really. You should be able to pass that in to a custom control via custom property if you use the type java.util.HashMap I'd think. You'll need to type it in I'm sure. I've passed custom objects in by using java.lang.Object.
The custom control will get loaded during the Page Load event, and usually properties have to be available at that point. If they're loaded during the Render Response phase, that's too late. So your SSJS object will need to be Compute on Page Load.
To use contents of a repeat control, you would need to set repeatControls=true, otherwise the repeat is only built during render response. Until then it's just a single set of controls with no data in them. However, Im pretty sure repeatControls="true" means you only get the number of rows you define. You can't change it via a pager.
You can manually define the type of the custom property. For a standard SSJS Object you use "com.ibm.jscript.std.ObjectObject", for a SSJS Array you use "com.ibm.jscript.std.ArrayObject" etc. As editor for the custom property, I set the string editor ("String value").
I created a sort of template DB for my Xpages applications. It is not a true template, just a design I can grab code from to start a new Xpages db.
I copied over a cc and got this error:
"The unknown namespace tag xe:applicationLayout cannot be used as a control, as the namespace http://www.ibm.com/xsp/coreex is not known."
I tried to creating a new cc in the target db and just pasting the source in, still got that error. What does that error mean and how can I overcome it?
I mean, come on, I can't copy and past design elements from one db to another???
It means that you haven't enabled the ExtLib in the application's properties. If you do to the Xsp Properties (in 9.0+) or Application Properties (in ancient releases), you can enable the com.ibm.xsp.extlib.library library, assuming you have it installed.
There is an event that can be triggered when dropping a native control onto an XPage or Custom Control. That event is used to enable the library in Xsp Properties. It's also used to enable the relevant abbreviation (xe, xc etc) on the pages. The bottom line is copy and paste isn't that sophisticated!
And it's not exclusive to the Extension Library. Try copying and pasting a Custom Control to a brand new XPage and save it. It will give you virtually the same message, but this time saying "xc" is not bound.
You need to enable the Extension Library manually if you're copying a custom control across. Alternatively, you can just drag and drop any Extension Library control onto any page in the application, then delete it!
If you're copying source code from one XPage to another, if it includes anything other than an xp tag, you need to check the relevant xml namespace is specified in the xp:view tag. So in the case of copying source code for the application layout, also adding xmlns:xe="http://www.ibm.com/xsp/coreex" to the xp:view tag.
(This was too long an elaboration to just add as a comment to Jesse's answer, which I've up-voted)
It seems the only way to open a client-side dialog is from within an embedded control which doesn't work for me. Most of my coding to populate the dialogs is contained in an external script library, yet when I try to XSP.openDialog(id) I receive a jumbled javascript error on Firebug.
I have tried
Accessing the object (an extension library dialog) directly from a button on the xpages. It opens without a problem
Calling a script function from an embedded button and passing the id of the dialog. Error.
Created a global variable containing the id of the dialog and called directly from a button. WORKS
Same global variable, but called in a javascript function. ERROR
from within script created variable with dojo.byId. ERROR
Is there something else I need to configure? Many of the buttons I will be using are also dynamically generated from a JSON-supplied feed.