dominoGuru.com

Your Development & Design Resource

Nested XPage viewPanels in viewColumns (with meme-themed demo)

Most IBM Lotus Notes application that have a parent/child relationship (either via the prototypical response NotesDocument storing a parent UniversalID in the response's $Ref NotesItem or a pseudo-parent/child NotesData relationship that often uses a shared key value in some arbitrary NotesItem...) has at least one view that shows a threaded display.

Threaded View Example: IBM Lotus 
Notes Client Discussion Database Threaded View Example: IBM Lotus Notes Client Discussion Database

We've been conditioned from the very beginning as Lotus Notes Developers that -- due to a rendering paradigm -- the most effective way to display related NotesData was through this threaded rows model.

We carried that same threaded rows model to the web as Lotus Notes Domino Developers. Sure, application fidelity is a huge factor here... even though the Web Browser Client offered us much more flexibility to create (ironically) often richer user interfaces and more (and at often times much more competitive to other enterprise application platforms) engaging user experiences.

And we have carried that same threaded rows model like an albatross into XPages as IBM Lotus Notes Domino XPage Developers for absolutely no reason!

See, there are two huge limitations with the View Design Element:

  1. The View Selection means a one NotesDocument per row-based NotesDocumentCollection iteration model.
  2. The inability to do NotesData merges with an external data source. (i.e., the NotesDocument, even parent/child entries, must reside in the same NotesDatabase).

With XPages, neither of these limitations exist. We can very easily do Joins of NotesData (and non-NotesData) from multiple data sources, both internal and external to the current NotesDatabase.

And this can all be surfaced by a simple viewPanel Control.

While chatting with Tim the other day, I wondered aloud if I could surface parent/child relationships in a viewColumn of a viewPanel control using the techniques discussed here.

So this past Sunday evening, I thought I would play around and see if I could surface a simple View which contained response NotesDocuments in the viewColumn of a viewPanel containing their parent NotesDocuments.

I first wanted to see if I could use simple context-sensitive inline buttons in the viewColumn to throw a sessionScope variable, partial refresh, and show to a dialog containing a viewPanel keyed to said sessionScope variable.

... and it worked like a charm.

The most out of the box and verbose XPages markup for the Dialog.xsp can be viewed here: Dialog.xsp XPage Markup

The result was simple yet spoke volumes of the potential of this technique:

Xzibit Views in Views XPages Demo - Dialog.xsp Xzibit Views in Views XPages Demo - Dialog.xsp

Seeing how well the dialog approach went, I thought I'd see if I could actually embed a response viewPanel into the viewColumn of my parent viewPanel.

... again, it worked brilliantly!

The most out of the box and verbose XPages markup for the Inline.xsp can be viewed here: Inline.xsp XPage Markup

Xzibit Views in Views XPages Demo - Inline.xsp Xzibit Views in Views XPages Demo - Inline.xsp

YO DAWG I PUT A VIEW IN YOUR VIEWS SO YOU CAN VIEW YOUR VIEWS WHILE YOU 
VIEW YOUR VIEWS For those of you not familiar with this meme...

... and with that and a little pimped out styling, I had my demo application:

Online Xzibit Demo

Xzibit - Views in Views XPages Demo

Xzibit Demo Download

Xzibit - Views in 
Views XPages Demo Download

Conclusion

All silly meme infusion aside, this is yet another example of XPages shattering the preconceived limitations of the IBM Lotus Notes Domino collaborative application platform. The responses in this case could have been defined in a remote NotesDatabase, pulled from an XML or JSON feed, or with a few more of the OpenNTF.org Extension Library controls combined in realtime with various web services including Facebook, LinkedIn, Twitter, et al.

The beauty of this approach is in its simplicity. Aside from a few styling changes, you could easily drag-and-drop your way through building this exact demo. Take this a step further (as I hope you do), and you'll immediately see the potential.

What might help is to consider the viewPanel nothing more than a NotesViewEntryCollection. The viewPanel contents can be trimmed, searched, sliced and diced however it's needed. What you do with the individual entry is up to you... and a simple .getDocument() means that you now have complete read/write control over the individual NotesDocument.

Amazingly powerful stuff...


About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of dominoGuru.com, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.



More from dominoGuru.com


dominoGuru.com is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, dominoGuru.com by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.