None
PermaLink I'll be speaking at The View's Lotus Developer 2010 Conference04/28/2010
None
I'll be speaking at The View's Lotus Developer 2010 in Boston on May 12th to the 14th.  If you see me there, please stop by and introduce yourself.  That's the best part about conferences....meeting new people.

I have 2 sessions.  Currently, both are being scheduled to repeat, so I'll be busy.  Here's the descriptions:

XPages: Write once, run everywhere!
With the latest release of Domino Designer, the platforms for running your XPages applications have been significantly expanded. Attend this session for a deeper understanding of the new XPages features in version 8.5.1 and how to leverage them in your applications. See how XPages now runs in the Notes client including the settings you’ll need for client launch and themes as well as customizing your XPages based on the client type using JavaScript or @commands. Take a deep dive into the Component Design Element to learn step-by-step how to create components as well as how to produce Actions and Events for wiring in composite applications. See how to simply include XPages components in composite applications as well as iWidgets for both the IBM Mashup Center and WebSphere Portal. Take home a copy of the applications used in the presentation with full access to the code.

Building Rich Internet Applications in Domino using AJAX, JSON, and the Dojo toolkit
Are your Domino Applications so yesterday? Bring your apps into the Web 2.0 world with a Rich Internet Application (RIA) facelift utilizing JSON, AJAX, and Dojo. Get an explanation of JSON (JavaScript Object Notation) — what it is, how it works, and why you want to use it. Get an understanding of the advantages of JSON over XML for building RIA applications with Domino. Learn how Domino can natively serve up JSON as well as how to generate JSON with agents and views. Explore the Dojo toolkit, an AJAX framework that now ships with Lotus Domino, and learn how you can leverage Dojo to build Rich Internet Applications. Walk away with an understanding of JSON, how to utilize JSON in AJAX frameworks, the Dojo toolkit, as well as a sample database with code.

Hope to see you there!

-John
Technorati:
(0)

PermaLink XPages - How to pass a Document Data Source to a Custom Control08/17/2009 06:29 AM
None
In a previous article I explained how you can use the undocumented currentDocument data source object to get the data source for the XPage from a Custom Control.  This works great if the XPage has one data source. What if you have multiple data sources?  For example, you want to include a custom control within a repeat control that is accessing multiple documents from a document collection or a view.  The currentDocument variable would only point to the first data source on the XPage.

At first glance, looking at the data types that are available for parameters in a Custom Control, you cannot pass a data source object. The type list drop down is a list of standard JavaScript variable types.

Image:John's Blog - XPages - How to pass a Document Data Source to a Custom Control



But, if you click on the folder icon next to the Type field you will see an extended list of type available.

Image:John's Blog - XPages - How to pass a Document Data Source to a Custom Control


Then from your XPage you can pass the datasource using computed JavaScript, such as: "OrderDetails.getDocument();"

*updated - see note below

Image:John's Blog - XPages - How to pass a Document Data Source to a Custom Control

Binding fields on a Custom Control to a dynamic datasource
The second part of this can be tricky.  On your Custom Control you cannot use the "Simple Data Binding" option to bind your fields since you have no datasource set for the Custom Control, the datasource is dynamic.  

The perfect solution for this is to use the Advanced -> Expression Language (EL) binding.  For example, to bind the field to the "Comment" field, we would use "compositeData.docdatasource.Comment".  Where....
- compositeData holds all the parameters for the Custom Control
- docdatasource is the parameter that we created that receives the datasource
- Comment is the field name on the Notes form

Image:John's Blog - XPages - How to pass a Document Data Source to a Custom Control

Now, with that said, there is an issue with this in 8.5.  DDE tries to convert the EL expression to a Simple data binding when you save and reopen the Custom Control. So it works the first time you enter it, but loses the binding when you edit the Custom Control.  However, it looks like this is fixed in 8.5.1.

BUT, no sweat, I have a workaround.  If you select JavaScript for the binding type, select "Compute on page load", and then enter the formula as '#{compositeData.docdatasource.Comment}' it will continue to work.

Image:John's Blog - XPages - How to pass a Document Data Source to a Custom Control


Here's an example of the Custom Control used with multiple Data Sources in action:

Image:John's Blog - XPages - How to pass a Document Data Source to a Custom Control

You can download this example here.

*update - by passing the NotesXSPDocument instead of the NotesDocument, the fields will automatically handle whether the document is in read or edit mode.

To do this, select "ModelDataSource" as the type for the property.  Then when passing the datasource from your XPage change the JavaScript from "OrderDetails.getDocument()" to just "OrderDetails".

-John

Technorati:
(0)

Search
Partner with us
Need help on your XPages projects?

Talk to the experts! Read more...
XPage Examples
By Category
About Me
Downloads
My Links
Monthly Archive
Powered by
Blogsphere
Lotus Domino ND7 RSS News Feed RSS Comments Feed Geo URL netcraft RSS Validator Lotus Geek Chris. A. Brandlehner OpenNTF BlogSphere