359 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Simple examples of how Google Developer Tools can aid Mobile Development
Thu, Oct 30th 2014 139
Binding jQuery code to an XPages partialRefresh using DOM Mutation events
Wed, Oct 29th 2014 221
Using jQuery .when() to trigger a screen update after select2 has loaded
Tue, Oct 28th 2014 124
Integrating the Bluemix Watson Translation service into an XPages application
Sun, Oct 19th 2014 349
Oh duh, that is why Node Package Manager (npm) is so cool
Tue, Oct 14th 2014 338
Create your own Watson Q and A example with Bluemix, Webstorm and Jazz Hub
Sun, Oct 12th 2014 760
Getting into IBM Bluemix….this could be interesting
Wed, Oct 8th 2014 272
Top 10
Arguably the most dangerous thing you could ever do in XPages – let other people use your eval() in their SSJS
Tue, Jun 18th 2013 1288
Create your own Watson Q and A example with Bluemix, Webstorm and Jazz Hub
Sun, Oct 12th 2014 760
Running an XPages/Angular.js application on a Bluemix site
Wed, Sep 17th 2014 558
Going to MWLUG 2014? Buy Dave Leedy a beer
Sun, Aug 24th 2014 452
Angular.js in XPages #7 – Writing better code using Services
Sun, Aug 3rd 2014 428
EXTJS in XPages #13: Totaling your columns with a groupingSummary
Sun, Jun 30th 2013 410
Speaking at MWLUG 2014: Write once, run anywhere – Angular.js in XPages
Tue, Jul 8th 2014 403
Taking back productivity in Domino Designer (a NotesIn9 production)
Tue, Jul 29th 2014 395
Hi Chicago – what changed?
Wed, Jul 2nd 2014 374
Web Components – Entering the ShadowDOM….
Wed, Jul 9th 2014 349


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
59 hits



Recent Blog Posts
139


Simple examples of how Google Developer Tools can aid Mobile Development
Thu, Oct 30th 2014 7:36p   Mark Roden
In this article I will show some simple examples of how Google Developer Tools can be used to help in mobile (responsive) development. Introduction Google Developer Tools (F12) within Chrome is one of those things which you *know* is way more powerful that you have ever cared to look at but this week I was introduced to a very cool new feature – thanks to @simonreid123. The ability to control the veiwport and size of the viewing window, as well as being able to throttle the speed of page [read] Keywords: development google iphone mobile network twitter
221


Binding jQuery code to an XPages partialRefresh using DOM Mutation events
Wed, Oct 29th 2014 7:38p   Mark Roden
Introduction In this article I will demonstrate how to bind to the event which triggers on the completion of an XPages partialRefresh. Using that binding we will then be able to action to contents of the newly added partialRefresh DOM elements. Background In multiple articles I have discussed the use of the onComplete event of a programmatically triggered partialRefresh to be able to re-apply a jQuery plugin’s bindings to an area of an XPage. This works very nicely and integrates with the [read] Keywords: domino xpages application css dojo server
124


Using jQuery .when() to trigger a screen update after select2 has loaded
Tue, Oct 28th 2014 5:58a   Mark Roden
We have an XPage with over 100 complex fields on it and we found that applying Select2 to it took a noticeable amount of time – tangible to the user. Users would see the original “SELECT” fields before the nicer select2 style was applied. So we determined to hide all the fields on the form until select2 was finished loading, then show them all select2’d. The problem was that would could not find an obviously way to do this. I was looking for a parameter within the s [read] Keywords: xpages css
349


Integrating the Bluemix Watson Translation service into an XPages application
Sun, Oct 19th 2014 7:07p   Mark Roden
In this article I will demonstrate how to integrate the Bluemix Watson Translation service into a functioning XPages application. Bluemix Watson Translation Service Following on from one from my previous posts on the subject I have been looking for a good workable example of using a Bluemix service within an XPages application. As I said before this is as much an exercise in me learning more about node.js and Bluemix as anything else – but I also love being able to share. Based on the [read] Keywords: domino ibm notes xpages ajax application development server xml
338


Oh duh, that is why Node Package Manager (npm) is so cool
Tue, Oct 14th 2014 9:07p   Mark Roden
I am in the process of playing with Bluemix and part of the reason or this is to learn more about node.js. It is really cool to learn something new and also to broaden the mind. But I digress – Node Package Manager (npm) makes using node.js so simple it is mind boggling… Without going into masses of detail on node.js (which I might at some point) here is the simple example of what I am trying to do and why npm is so cool. Node Package Manager (npm) allows you to install any node [read] Keywords: application applications interface
760


Create your own Watson Q and A example with Bluemix, Webstorm and Jazz Hub
Sun, Oct 12th 2014 10:19p   Mark Roden
Introduction In this article I will demonstrate how to get up and running with one of the Bluemix/Watson service examples. I will be using the example provided by IBM in their documentation as the basis for the article but the way in which I achieved the final goal was quite different from the way that they explained it in the example. This example will use: IBM Bluemix as my service provider The Watson Question and Answer service A Node.js service to host the website JetBrains Webstorm IDE [read] Keywords: domino ibm application css integration javascript password server




272


Getting into IBM Bluemix….this could be interesting
Wed, Oct 8th 2014 7:12p   Mark Roden
My interest in IBM Bluemix has grown since it was announced. I took part in the Beta, but frankly didn’t do very much because I really couldn’t figure out what it was or why I cared. Since then though IBM has announced that they are investigating putting Domino into Bluemix. Before I start down this path I have to say at this point that I have no idea what “Domino in Bluemix” even means. I have no idea what that will look like and while I would love to second guess a [read] Keywords: domino ibm xpages application applications development interface java mobile server
199


Opening an XPage in XPiNC and passing Query_String parameters
Tue, Sep 30th 2014 7:22p   Mark Roden
I was very pleasantly surprised to find this works – coincidentally – twice this week someone has asked this question – can I open an XPage in XPiNC directly? I thought the answer was no……and not for the first (and/or last) time I was wrong. The answer lies here – http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Domino_Designer_URLs_for_XPages To prove it I created a plain XPage and added the firebugLite custom control The following XPiNC URL notes://copper/882579C [read] Keywords: ldd lotus notes
271


Closing soon: IBM Domino/Notes Community Survey
Mon, Sep 29th 2014 11:12a   Mark Roden
For the last two weeks PSC has been asking for input from the ICS community on what companies are planning on doing with their Domino Infrastructure. If you have not already done so, please take a couple of minutes to help. The results will be posted next week. http://bit.ly/PSCXPagesSurvey [read] Keywords: domino dominonotes ibm notes community
237


What is a social presence worth?
Sun, Sep 21st 2014 7:51p   Mark Roden
We had an interesting discussion internally at work about what exactly does our “Social Presence” do for us? I put time and thought to it and it turns out to be a question I can answer on many levels. I am still not entirely sure what the answer is. What does being social mean? Being social means sharing through ideas, code, concepts, dreams….anything really – but sharing it. Within the XPages community we have a multitude of people who are social for many different r [read] Keywords: domino ibm xpages community development java office sharepoint




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