Posted in XPages

Use Keyboard Right/Left to Navigate pager in xPages

add this scriptblock in your page to enable the keyboard left and right keys when you want to move around the view.

<xp:scriptBlock>
<xp:this.value><![CDATA[var pagerID = “#{id:pager1}”; // <– Enter the ID of the pager control here which would change based on left / right arrow keys

pagerID = pagerID.replace(/:/g, “\\3A”);
dojo.connect(document.body, “onkeydown”,
function(evt) {
switch (evt.keyCode) {
case dojo.keys.LEFT_ARROW:
evt.preventDefault();
var previousLink = dojo.query(“#” + pagerID + ” .xspPagerNav.xspPrevious a”)[0];
if (previousLink != null) {
previousLink.click();
}
break;
case dojo.keys.RIGHT_ARROW:
evt.preventDefault();
var nextLink = dojo.query(“#” + pagerID + ” .xspPagerNav.xspNext a”)[0];
if (nextLink != null) {
nextLink.click();
}
break;
}
}
);]]></xp:this.value>
</xp:scriptBlock>

Advertisements

Author:

Lotus Notes Consultant @ 77GSI. contact me thru ym: glennliwanag

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s