358 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Practice what you preach – be fast and look sexy
Tue, Dec 16th 2014 345
BTE 102: The Future of Web Development Write Once, Run Everywhere with AngularJS and Domino
Tue, Dec 16th 2014 315
Angular in XPages: Formatting Domino Data Services Date values with app.filter
Sun, Dec 14th 2014 310
Looking forward to IBM ConnectED – AD201: IBM Domino Applications in Bluemix
Thu, Dec 11th 2014 286
Websockets in XPages: Improving on the automated partialRefresh interface
Tue, Dec 9th 2014 479
XPages and Bluemix: Pushing out data changes through automated partialRefresh
Sun, Dec 7th 2014 220
XPages and Bluemix: Sending a targeted Websockets message to specific XPages
Sun, Nov 30th 2014 1970
Top 10
XPages and Bluemix: Sending a targeted Websockets message to specific XPages
Sun, Nov 30th 2014 1970
Creating an XPages Websockets chat client using Bluemix
Sun, Nov 9th 2014 1192
Create your own Watson Q and A example with Bluemix, Webstorm and Jazz Hub
Sun, Oct 12th 2014 566
Integrating the Bluemix Watson Translation service into an XPages application
Sun, Oct 19th 2014 521
Websockets in XPages: Improving on the automated partialRefresh interface
Tue, Dec 9th 2014 479
Binding jQuery code to an XPages partialRefresh using DOM Mutation events
Wed, Oct 29th 2014 399
Arguably the most dangerous thing you could ever do in XPages – let other people use your eval() in their SSJS
Tue, Jun 18th 2013 378
One way to make a responsive XPages viewPanel
Tue, Nov 11th 2014 361
Practice what you preach – be fast and look sexy
Tue, Dec 16th 2014 345
XPages and Bluemix: How to create a Websockets message without being connected to the application
Sun, Nov 16th 2014 328


jQuery in XPages #9 – PageSlide
MarkyRoden    

In this article I will describe how to implement and provide examples of use the jQuery plugin PageSlide within an XPage. This is a fairly simple plugin with very few parameters but provides an alternate method for displaying information to users

PageSlide.js

Demonstration

The XPages integration of PageSlide is demonstrated here

Download

The demonstration database can be downloaded from the link above or from here

Introduction

PageSlide by Scott Robin is a simple plugin which allows external content to be displayed in a sidebar on the page. There are only two parameters, direction (left or right) and modal (true or false).  It is really quite simple. As you will see my implementation does not use XPage XML markup to add resources or to activate the capability. I found that this caused issues in the browser. The capability works well using the example code from the website, applied in an XPage.

PageSlide showing data from another XPage to the side of the main

PageSlide showing data from another XPage to the side of the main

How does it work?

I added jQuery, the pageslide js library and the pageslide.css stylesheet to my database through the WebContents folder and added them to to my XPage via script and link tags.

		  <script src="js/jquery.pageslide.js"></script>
		  <script src="js/jquery-1.7.1.min.js"></script>
		  <link rel="stylesheet" type="text/css" href="css/jquery.pageslide.css" />

The basic concept works like this:

  • You create a link on the page
    • < a href=”xSomething.xsp” class=”aClass”>
  • You select the link in question
    • $(“a.aClass”).
  • You pageslide it
    • pageslide({direction: “left”, modal: false})

	<a href="xPageSlide_1.xsp" class="myClass">Display user information</a>
	<script>$("a.myClass").pageslide({ direction: "left", modal: false});</script>

When clicking on the link this produces the effect of opening xPageSlide_1.xsp in the right hand panel of the screen (direction: left moves everything to the left).
If the modal = true paramater is included then the “slide” can only be closed programmatically. This forces user interaction with the information. If not included or modal = false then clicking anywhere in the screen will make the slide disappear.

And that is pretty much it….. nothing complicated this week :)

More examples
I created a custom control with custom parameters so that the capability can be added to any page.

Custom Control properties

Custom Control properties

The example page contains a demo of this custom capability and it is build like this:

  • A link with a dynamic href is added to the form along with
  • A scriptBlock which adds the PageSlide capability to the link passing the custom parameters as necessary.

<xp:link escape="true" text="CompositeData example"
	id="compositeDataExample"
	value="${compositeData.content}" styleClass="marky">
</xp:link>
<xp:scriptBlock id="scriptBlock1">
	<xp:this.value><![CDATA[
		bModal = "#{compositeData.modal}"
		bModal == "false" ? false : true
		$("[id$=compositeDataExample]").pageslide(
			{ 	direction: "#{compositeData.direction}",
				modal: bModal
			});
	]]></xp:this.value>
</xp:scriptBlock>

The other example I created involves using sessionScope variables to look up information dynamically.

sliding in a new XPage with dynamic content

sliding in a new XPage with dynamic content

There is a hidden anchor tag on the form which is has PageSlide attached to it in a similar way as described above. It is hidden becasue we are going to “click” it programmatically when a user is selected in the comboBox.

<a href="xPageSlide_1.xsp" class="marky2" style="display:none">Display user information</a>
<script>$("a.marky2").pageslide({ direction: "right", modal: true });</script>

The combobox has a simple SSJS lookup formula showing the first column of the AllContacts view
#{javascript:@DbColumn(“”, “AllContacts”, 1)}

<xp:comboBox id="comboBox1" defaultValue="Pick a person">
	<xp:selectItem itemLabel="Pick a person" itemValue="Pick a person"></xp:selectItem><xp:selectItems>
		<xp:this.value><![CDATA[#{javascript:@DbColumn("", "AllContacts", 1)}]]></xp:this.value>
	</xp:selectItems>
	<xp:eventHandler event="onchange" submit="true" refreshMode="partial" refreshId="computedField1">
	</xp:eventHandler>
</xp:comboBox>

In the onChange event I perform a partial refresh of the computedField1. computedField1 looks like this and returns some JavaScript which triggers the link “.click()”

<xp:text escape="false" id="computedField1">
	<xp:this.value><![CDATA[#{javascript:var person = sessionScope.person=getComponent("comboBox1").getValue();
		var disp = "<script>$('a.marky2').click()</script>";
		disp2 = (person == "Pick a person" ? "" : disp);
		return disp2
	}]]>
	</xp:this.value>
</xp:text>

  • If a person is picked the computed field is refreshed
    • The computed field sets a sessionScope variable based on the value selected
      • var person = sessionScope.person=getComponent(“comboBox1″).getValue()
    • The refreshed value contains a script tag which executes when the refresh is loaded.
      • var disp = “// “;
        disp2 = (person == “Pick a person” ? “” : disp);
        return disp2
    • $(‘a.marky2′).click() clicks the hidden link opening the page slide

The xPageSlide_1.xsp page takes the sessionScope variable and looks up the user’s information based on the variable set in the computedField1 above.

<xp:div id="div1" style="display:nonex">
				    <h2 style="color: white">User Information</h2>
				    <xp:br></xp:br><xp:br></xp:br>
					<xp:text escape="true" id="computedField1"><xp:this.value><![CDATA[#{javascript:var per = sessionScope.person;
@DbLookup(@DbName(), "vwContacts", per, 4)}]]></xp:this.value></xp:text>

					<xp:br></xp:br>
					<xp:br></xp:br>
					<xp:text escape="true" id="computedField5"><xp:this.value><![CDATA[#{javascript:var per1 = sessionScope.person;
@DbLookup(@DbName(), "vwContacts", per1, 5)}]]></xp:this.value></xp:text>
					<xp:br></xp:br>
					<xp:br></xp:br>
					<xp:text escape="true" id="computedField3"><xp:this.value><![CDATA[#{javascript:var per2 = sessionScope.person;
@DbLookup(@DbName(), "vwContacts", per2, 6)}]]></xp:this.value></xp:text>
					<xp:br></xp:br>					<xp:br></xp:br>
										<xp:button id="button1" value="Close" style="display: block">
		<xp:eventHandler event="onclick" submit="false">
			<xp:this.script><![CDATA[parent.$.pageslide.close()]]></xp:this.script>
		</xp:eventHandler></xp:button><xp:br></xp:br>

</xp:div>

and with a little styling we are done for a consistent look and feel

<style>
DIV {
    background-color: #333333;
    color: #FFFFFF;
    height: 100%;
    padding: 20px;
    position: fixed;
    top: 0;
    width: 260px;
    z-index: 999999;
}

H2 { color: white }
</style>

Conclusion

I could easily see myself using PageSlide if I wanted to use a hidden menu or if I wanted to have a status update bar running in the background of my webpage which was accessed and made visible to the user when they wanted it to be there.

This is certainly the simplest plugin I have written about, but this is a very elegant solution to displaying hidden information to a user on demand.

Demonstration

The XPages integration of PageSlide is demonstrated here

 




---------------------
http://xomino.com/2012/05/08/jquery-in-xpages-9-pageslide/
May 08, 2012
26 hits



Recent Blog Posts
345


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 application network server
315


BTE 102: The Future of Web Development Write Once, Run Everywhere with AngularJS and Domino
Tue, Dec 16th 2014 5:33a   Mark Roden
Mark Leusink and I are very excited to be presenting a session at ConnectED this coming January. This is a great opportunity to come and find out about something a little different from the normal XPages run of the mill development. Mark and I will provide an introduction to the concepts and structure behind Angular.js, and then demonstrate how to build a very simple yet useful application using Angular.js and a Domino data store. We are also going to blow some minds by showing the same ap [read] Keywords: collaboration connections domino ibm xpages application development javascript
310


Angular in XPages: Formatting Domino Data Services Date values with app.filter
Sun, Dec 14th 2014 7:39p   Mark Roden
In this article I will show how we can use the core angular date filter capabilities to format Date format, Domino data into an Angular.js based application Introduction In previous articles I have shown how to create a simple Angular.js application using a notes Domino Data Services feed from a notes database. If we want to add “date” information then we need a way to nicely format it. Using the Angular.js documentation page as reference I will show you how we can do this with Do [read] Keywords: domino notes xpages application database google xml
286


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. https://www-950.ibm.com/events/global/ibmced/agenda/preview.html 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 ibm xpages applications
479


Websockets in XPages: Improving on the automated partialRefresh interface
Tue, Dec 9th 2014 5:59p   Mark Roden
In this article I will further discuss how tom improve the user experience of an automated partial Refresh on an user’s XPage. Although these posts were originally about using Bluemix to host the node.js server I kinda feel that the focus has drifted onto websockets more than Bluemix. So in an attempt to make it easier to find I am going to use the Websockets in XPages title moniker for a few posts and then go back to Bluemix :) Introduction In the last article we looked at how to push [read] Keywords: xpages application css interface server wiki
220


XPages and Bluemix: Pushing out data changes through automated partialRefresh
Sun, Dec 7th 2014 7:32p   Mark Roden
In this article I will demonstrate how using targeted websockets messages we are able to refresh user data on pertinent screens within an application, and keep user’s data up to date. Introduction In previous articles I have discussed the creation of a nodejs websockets service within Bluemix and how we are able to send messages to specific web pages using the socket.io rooms capability. Both of those examples were proofs of concept and the messages were generated in the browser via fireb [read] Keywords: xpages ajax application applications css javascript server xml
1970


XPages and Bluemix: Sending a targeted Websockets message to specific XPages
Sun, Nov 30th 2014 6:51p   Mark Roden
In this article I will demonstrate how the use of socket.io “rooms” enables us to send message to users who are only accessing specific pages within our application, rather than blanket messages to all users. Introduction In the previous article I demonstrated how to use a message POST to the node.js server which could then be turned into a chat message and sent out to all users. While this is a nice example it only serves as such and does not have significant business value. In thi [read] Keywords: domino xpages ajax application applications development javascript server xml




232


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
282


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 openntf
322


Got non-XPages design elements? You really should use WebContent.
Mon, Nov 17th 2014 7:20p   Mark Roden
Recently I was able to help explain an issue Russ Maher was having with his application png files - http://xpagetips.blogspot.com/2014/11/got-png-you-may-get-problems.html. It got me thinking that as modern web developers (which is what XPage developers need to be), we should not be using Domino database elements for “web elements”. Back before R8 we all used the Database Files, Style sheets and Database Images as a way to reference files as part of the database. I now believe w [read] Keywords: domino R8 xpages application applications css database development server




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition