358 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Opening an XPage in XPiNC and passing Query_String parameters
Tue, Sep 30th 2014 104
Closing soon: IBM Domino/Notes Community Survey
Mon, Sep 29th 2014 185
What is a social presence worth?
Sun, Sep 21st 2014 173
Running an XPages/Angular.js application on a Bluemix site
Wed, Sep 17th 2014 479
MWLUG 2014 Slide Deck – Write once, run anywhere: Angular.js in XPages.
Tue, Sep 2nd 2014 170
Going to MWLUG 2014? You need to buy these guys a beer as well….
Sun, Aug 24th 2014 227
Going to MWLUG 2014? Buy Dave Leedy a beer
Sun, Aug 24th 2014 386
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 1032
Running an XPages/Angular.js application on a Bluemix site
Wed, Sep 17th 2014 479
Going to MWLUG 2014? Buy Dave Leedy a beer
Sun, Aug 24th 2014 386
Angular.js in XPages #7 – Writing better code using Services
Sun, Aug 3rd 2014 373
Taking back productivity in Domino Designer (a NotesIn9 production)
Tue, Jul 29th 2014 345
Speaking at MWLUG 2014: Write once, run anywhere – Angular.js in XPages
Tue, Jul 8th 2014 343
Hi Chicago – what changed?
Wed, Jul 2nd 2014 335
EXTJS in XPages #13: Totaling your columns with a groupingSummary
Sun, Jun 30th 2013 324
Web Components – Entering the ShadowDOM….
Wed, Jul 9th 2014 303
The consummate Champion
Thu, Jul 24th 2014 295


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



Recent Blog Posts
104


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
185


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
173


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
479


Running an XPages/Angular.js application on a Bluemix site
Wed, Sep 17th 2014 7:48p   Mark Roden
In this article I will show you how to run an XPages application based on Angular data within a Bluemix based website. Introduction For background reading on this article please review my series on Angular.js in XPages starting here. I will be using the application described within that article as the starting point for this article. A little background on Bluemix Bluemix is IBM’s new Platform as a Service (PaaS) system which provides the end to end cloud based hosting of application [read] Keywords: domino ibm xpages application applications bug community database interface server skype
170


MWLUG 2014 Slide Deck – Write once, run anywhere: Angular.js in XPages.
Tue, Sep 2nd 2014 1:05p   Mark Roden
Here is the slide deck for those interested – thank you to everyone who attended the presentation and I look forward to talking more on the subject in the future. http://www.slideshare.net/MarkRoden/angularjs-in-xpages [read] Keywords: xpages
227


Going to MWLUG 2014? You need to buy these guys a beer as well….
Sun, Aug 24th 2014 8:07p   Mark Roden
—->>>> Richard Moy [read] Keywords:
386


Going to MWLUG 2014? Buy Dave Leedy a beer
Sun, Aug 24th 2014 5:37p   Mark Roden
Yeah I know I have rattled on about this before but it holds as true today as it does any other day before. Here is a list of reasons you should buy Dave Leedy a beer in case you were wondering… 1) really? You need a list?? Shame on you…. 2) NotesIn9 has helped you – One of those videos by Dave, John, John, Brian, Chris, Graham, Jeremy, Mark, Mark, Paul, Peter, Steve, Tim, Chris, Paul, Josh, Dan, Niklas, Michael, Russ, Serdar, Sean, Mark, Brad, Frederick, Steve, Richard, Kathy, [read] Keywords: ibm community




243


Chart Directives and Dynamic Binding – MWLUG 2014 preview
Wed, Aug 20th 2014 7:13p   Mark Roden
Although not directly related to the purpose of the presentation I am going to demonstrate how to use an Angular.js chart directive to bind to the application service data and create dynamic charting within the application. Changing the Zip for 1 Marky not only updates the data displayed – but also because of the data bind – auto-magically updates the chart While this in itself does not directly relate to the write once and run anywhere nature of the presentation – it d [read] Keywords: application
183


Accessing the original element when using Select2-focus
Sun, Aug 17th 2014 7:36p   Mark Roden
In the application we are currently working on I wanted to add an ajax call to a JSON service, but only for certain fields. Rather than go through the application and add the code to every element I used a delegated focus event for the field with an attribute of  “help_fieldName”. The following HTML represents the code on the form: UK US Global First Name Last Name The following jQuery code makes it work. The getHelp function shows/hides [read] Keywords: ajax application xml
216


Angular in XPages #8 – Directives (did someone say plugins?)
Sun, Aug 10th 2014 8:08p   Mark Roden
In this article I will discuss Angular Directives and why they are near and dear to my heart Directives Directives in Angular are modular pieces of functionality which in some cases are very analogous to plugins in jQuery. According to the Angular documentation… “At a high level, directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS’s HTML compiler ($compile) to attach a specified behavior to that DOM element or [read] Keywords: xpages application css




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