In this article I will demonstrate a technique for dynamically expanding and contracting viewPanel rows. This provides a nice clean interface for the user and allows content to be made visible as necessary. This article also highlights many of the core jQuery capabilities.
When moving from a notes client application to the web often times view columns can be large and unwieldy
A boring notes view
Unwieldy data view on an XPage
What we are going to do is not only neaten up the display but provide some simple user interactivity to allow access to data as needed. Here is a quick video of the capability in action.
You can see a working example of the capability on the xomino site. In Firefox and Chrome the fade effect look just fine but due to issues with alpha filters fade does not work consistently in IE.
How does it work?
As you can see from the pictures above, once we put our view into an xPage and display it on the web, the entire contents of the data field are displayed on the page. This can make for an irritating session with customer who don’t want to have to scroll page after page to find their information but want the same view to be available through the notes client.
Once solution would be to determine the medium through which your data is being viewed and truncate it accordingly. But I went another route and made a compromise where the data is available if the users wants it (adding functionality to the page without them having to click and open the document) but does not take up a large amount of space.
I added jQuery and jQueryUI (CSS not code) to my database through the WebContent folder and to my XPage like this
Select all the 4th column Table cells in the viewPanel and cycle through each of them
//select all elements (one in this case) where the id ends with (id$=) viewPanel1
//within that select all rows (tr)
//within that select all the table cells (td)
//within that select only the cells which are the 4th child element (:nth-child(4))
//cycle through each of them (.each(function(i)) where i is the nth item in the cycle
$("#[id$='viewPanel1'] tr td:nth-child(4)").each(function (i)
Because we have fixed the column width we are able to accurately ascertain the height of the cell contents on the page
As we then cycle through the viewPanel TD cells we determine if the cell contents are larger than 100pixels. If they are then we surround the contents with a wrapper with a fixed height.
//$(this) means each jQuery object (representing the TD as we cycle through the column
//.append is as it sounds - append to the end this SPAN (with the arrow in it)
//.children(:first) selects the first SPAN within the TD we are working on and
//.wrap means surround the SPAN with the DIV
$(this).append('<span class="ui-icon ui-icon-arrowthick-1-s"></span>').children(":first").wrap('<div class="wrapper" />')
ok trying to visualize what is going on we start with something which looks like this
We .append() another span
We then .wrap() the :first Child of the TD with a Div
And there you have it. We have looked at a broad range of jQuery capabilities and brought them all together to create a great looking interface for the end user. All these capabilities are part of the jQuery core and I only used jQueryUI to get the cute up and down arrows. If you wanted to use an icon there is nothing stopping you removing the jQueryUI dependency.
We have looked at jQuery Selectors
attribute selector $(“#id$=
class selector $(‘.wrapper
We have looked at DOM traversing and manipulation techniques
We have looked at attaching events to DOM elements
We have looked at object properties
We have looked at multiple visual manipulation capabilities
Practice what you preach – be fast and look sexy
Tue, Dec 16th 2014 5:19p Mark Roden As people who know me well may have heard once or twice, user experience is everything. When designing a custom web based application for a customer, there is always an unwritten requirement of “look sexy” and be fast.
This week my team and I at PSC successfully rolled out a new global application to a customer and here are some examples of the feedback we received within the first day or so:
I tried the new site only this morning and I have only one word: fantastic! It is very u [read] Keywords: domino
Looking forward to IBM ConnectED – AD201: IBM Domino Applications in Bluemix
Thu, Dec 11th 2014 8:04p Mark Roden The session preview tool for ConnectED 2015 has been announced.
Looking through it I found the following abstract – which unsurprisingly has me really excited !!!
AD201: IBM Domino Applications in Bluemix
This session will show how Bluemix enables you to deploy Domino applications to the cloud in a matter of minutes. We will demonstrate how to leverage Bluemix buildpacks like XPages and Node.js both to modernize Domino applic [read] Keywords: domino
Multiple Chrome Incognito browsers share the same data
Sun, Nov 23rd 2014 7:15p Mark Roden In a previous post I talked about how going porn-mode on your browser is great for a developer. What I didn’t realize until today is that incognito mode is not as unique as I want it to be.
We use localStorage in one of the applications we are developing and I had issues when I was opening up multiple Chrome Incognito mode browsers, assuming they were unique….I wanted to compare separate instances in separate windows
Mr. Genius (Toby) pointed out to me that localStorage is shared a [read] Keywords: applications
x$ – now a part of XPages Extension Library
Tue, Nov 18th 2014 9:16p Mark Roden I am very flattered to find out that not only is my x$ OpenNTF xSnippet being used more widely than I realized (over 600 downloads). It now being used in the latest release of the OpenNTF Extension library.
If you look here – http://bootstrap4xpages.com/xsp/.ibmxspres/.extlib/responsive/xpages/js/xsp-mixin.js and search for it you will find
//jQuery selector that works with XPages IDs
//See - http://openntf.org/XSnippets.nsf/snippet.xsp?id=x-jquery-selector-for-xpages
function x$(id [read] Keywords: xpages community