A Flexible View Control for XPages Part 1 – IntroductionPosted: December 4, 2019
In my last post, I stated I would be expanding on the topics from my session “Real World XPages” at Collabsphere 2019.
The first topic is A Flexible View Control for XPages, a custom control integrated with jQuery and DataTables that once added to your design (along with it’s companion elements) can easily be added to any XPage and connected to back-end Domino data in minutes through a Domino REST Service or an XAgent.
Why was this created?
- Frustration with the available tools in XPages for displaying view data. Anyone that has tangled with a View Panel knows exactly what I’m talking about.
- Efficiency in development by avoiding recreating the same code over and over again. When I make a change to the design of this control all of the views created with it get the update immediately.
- To minimize view overhead. One view can be reused over and over which minimizes the number of view indexes that need to be built and maintained. Say goodbye to creating a view just because you need to show your data sorted by a different column!
This tool has been battle-tested in production for 4-5 years with every view and embedded view in our huge XPage application utilizing this control to surface data. Over those 4-5 years it has grown and evolved to be extremely flexible and capable of handling many different use cases. It has been, without a doubt, the single most important piece of functionality in our application as it has been leveraged over and over again to surface data.
At CollabSphere Andrew Davis of HCL stated that “XPages is still the recommended technology in the Domino stack to modernize applications” (paraphrasing). Obviously, this could change with Domino V11 and beyond. But wIth the recent chatter about XPages and the desire many still have to continue creating and enhancing applications, my hope is others will find the value in this tool that I have.
How it works
- View Definitions are the ‘wiring’ for the Flexible View Control.
- They are stored as Lotus Notes Documents and act as the View design for the Flexible View Control. This moves much of the management of views out of the actual design element.
- One View can be represented many different ways with different sorting, column orders and even categorization.
- The Lotus Notes View simply acts as a table of data served via REST services.
- View rendering is done client side with DataTables.
How to get the code
The Flexible View Control for XPages is available on github:
Here you will find detailed descriptions of the project assets and custom control properties. Before diving in, I highly recommend absorbing the next few blog posts which will detail and explain how to get everything set up and demonstrate how to make effective use of the control.
- The included theme loads jQuery and DataTables from a public CDN
- The out-of-box UI is very plain to make it easier to integrate with existing projects
- While Bootstrap is not required, the control is already equipped to integrate with Bootstrap
Stay tuned for Part 2 (and beyond) where I will demo how easy it is to get the database/control setup and connected to data!