357 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Taking back productivity in Domino Designer (a NotesIn9 production)
Tue, Jul 29th 2014 177
The consummate Champion
Thu, Jul 24th 2014 190
Web Components – Entering the ShadowDOM….
Wed, Jul 9th 2014 189
Speaking at MWLUG 2014: Write once, run anywhere – Angular.js in XPages
Tue, Jul 8th 2014 248
Hi Chicago – what changed?
Wed, Jul 2nd 2014 267
Angular.js in XPages #6 – A People Manager CRUD application
Sun, Jun 1st 2014 421
Angular.js in XPages #5 – Routing
Sun, May 25th 2014 314
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 1052
Why learning JavaScript is more critical to XPage developers than Java
Wed, Mar 26th 2014 938
An open letter to Mr. NotesIn9
Wed, Apr 2nd 2014 615
EXTJS in XPages #14 – Grid editing and saving data via REST CRUD
Thu, Aug 1st 2013 577
Adding custom HTTP headers to Domino R9 using IBM HTTP Server (IHS)
Sun, Apr 20th 2014 558
EXTJS in XPages #13: Totaling your columns with a groupingSummary
Sun, Jun 30th 2013 538
Angular.js in XPages #1 – Using the right IDE for development
Sun, Apr 27th 2014 509
And the gloves are off……
Mon, Mar 31st 2014 497
Why using XPages Partial Refresh is sometimes easy for developers and bad for users
Tue, Mar 4th 2014 484
WebSockets comes to XPages!! Awesome – Awesome – Awesome
Tue, May 20th 2014 476


x$ update for dojo
MarkyRoden    

Problem
dojo selector –  ”dojo.query” doesn’t work for elements generated by xpages

Background

This is a follow on to the jQuery selector function for xPages – x$(“#{id:inputText1}”) article I wrote previously.

Solution

Turns out that dojo.query suffers from the same problem:  dojo.query cannot understand elements with colons (:) in it. We have to convert the idTag of the element to escape the colons with a backslash.

  • dojo.query(“view:_id1:inputText1″).style(“border”, “1px solid red”) – will not work
  • dojo.query(“view:_id1:inputText1″).style(“border”, “1px solid red”) – will work and is converted using the function

So I have updated my x$ function to cover dojo and jQuery


function x$(idTag, param, jd){ //Updated 28 Feb 2012
      idTag=idTag.replace(/:/gi, "\:")+(param ? param : "");
      return( jd=="d" ? "#"+idTag : $("#"+idTag));
}

the param and jd parameters are optional (in fact jd is only necessary if you are using dojo)

Interesting Note

For the uninitiated you will note that jQuery returns a $() rather than a string – this is because it is actually returning a jQuery Object. That is a fundamental difference in the way that dojo and jQuery function as code libraries.

Examples

here is an example code of how it would be used in dojo or jQuery


//dojo
dojo.query(x$("#{id:inputText1}", "", "d")).style("border", "1px solid red")

//jQuery equivalent

x$("#{id:inputText1}").css("background-image", "1px solid red")

An example is shown below

<?xml version="1.0" encoding="UTF-8"?>

<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

<xp:br></xp:br>
 <xp:scriptBlock id="scriptBlock1">
 <xp:this.value><![CDATA[
 function x$(idTag, param, jd){ //Updated 28 Feb 2012
 idTag=idTag.replace(/:/gi, "\:")+(param ? param : "");
 return( jd=="d" ? "#"+idTag : $("#"+idTag));
 }
 ]]>
 </xp:this.value>
 </xp:scriptBlock>
 <xp:inputText id="inputText1"></xp:inputText>
 <xp:br></xp:br>
 <xp:br></xp:br>
 <xp:button value="Change Border (Fail)" id="button2">
 <xp:eventHandler event="onclick" submit="false">
 <xp:this.script><![CDATA[dojo.query("#{id:inputText1}").style("border", "1px solid red")]]></xp:this.script>
 </xp:eventHandler>
 </xp:button>
 <xp:br></xp:br>
 <xp:br></xp:br>
 <xp:button value="Change Border X$" id="button1">
 <xp:eventHandler event="onclick" submit="false">
 <xp:this.script><![CDATA[dojo.query(x$("#{id:inputText1}", "", "d")).style("border", "1px solid red")]]></xp:this.script>
 </xp:eventHandler>
 </xp:button>
</xp:view>




---------------------
http://xomino.com/2012/02/28/x-update-for-dojo/
Feb 28, 2012
57 hits



Recent Blog Posts
177


Taking back productivity in Domino Designer (a NotesIn9 production)
Tue, Jul 29th 2014 3:27p   Mark Roden
Yeah it has been a while (over 18 months) since the last time I did a NotesIn9 video but it finally happened again. NotesIn9 149:  Database Resources and Design Definition Doesn’t sound very exciting does it? Dave needs to work on his attention grabbing heading show names. I would have called it something more like this – but then who am I to complain – it is not my show after all ;) NotesIn9 149:  Taking back productivity in Domino Designer  This video revolves around som [read] Keywords: domino notes xpages database eclipse
190


The consummate Champion
Thu, Jul 24th 2014 8:42p   Mark Roden
As Russ Maher said today in Hey Who got the Handsome Champion it is an honor and a privilege to not only be recognized by IBM as a Champion for ICS 2014, but you also get some very cool stuff. Thanks to Amanda Bauman and Oliver Heinz for organizing “the champions” and all the gear. I just wonder what I am going to do with all of it :) Seriously though, I am very humbled to be an IBM Champion ! Thank you to everyone who nominated me and made this possible :) [read] Keywords: ibm
189


Web Components – Entering the ShadowDOM….
Wed, Jul 9th 2014 9:18p   Mark Roden
Web Components – the future You should first ground yourself on Web Components and read this article on Web Components and concepts, ShadowDOM, imports, templates, custom elements by Todd Motto. Then listen to this Podcast (thanks to Steve for pointing it out) - Web Components with Peter Gasston Once you have read/listened you will have some idea and concept about Web Components and how they are the future….. But what I wanted to show briefly was how to enable the ShadowDOM in C [read] Keywords: agent javascript podcast
248


Speaking at MWLUG 2014: Write once, run anywhere – Angular.js in XPages
Tue, Jul 8th 2014 10:55a   Mark Roden
I am very fortunate and excited to announce that I have been accepted to speak at MWLUG 2014. MWLUG will always have a fond place in my heart because I had my first speaking session there back in 2012 and had such a fantastic time it pushed me to do more. I will speak speaking about Angular.js and the opportunity it avails us as Web Developers. We all know IBM Domino is arguably to world’s most secure and mature NoSQL database. So we will take a look at how we can use it like a NoSQL [read] Keywords: domino ibm xpages application applications database development server
267


Hi Chicago – what changed?
Wed, Jul 2nd 2014 7:16a   Mark Roden
Well it has been on the cards now for 6 months but we finally did it. My family and I moved from Virginia to Chicago and I have started working out of the PSC office in Schaumburg, IL. I was asked nearly 18 months ago if I would consider moving, but for mostly family reasons it took a year or so to organize and agree this was the right thing to do for my career and just as importantly for the family. Working at home has been wonderful for the past two years. But it was also a little limiting [read] Keywords: office
421


Angular.js in XPages #6 – A People Manager CRUD application
Sun, Jun 1st 2014 6:58p   Mark Roden
In this article I will bring together everything discussed in the first 5 articles and demonstrate how to create you first basic CRUD application using Angular.js and XPages. Previous articles Angular.js in XPages #5 – Routing Angular.js in XPages #4 – Using Domino Data Angular.js in XPages #3 – The first app Angular.js in XPages #2 – Setting up a Webstorm / Domino development environment Angular.js in XPages #1 – Using the right IDE for development Introduction In the last article w [read] Keywords: domino ibm ods R8 xpages application database development firefox iphone javascript properties server xml




314


Angular.js in XPages #5 – Routing
Sun, May 25th 2014 6:52p   Mark Roden
In this article I will show how angular using routing to create a bookmarkable URL string and how that fits together with additional controllers. This will start us on the path to creating our basic CRUD application. This article is based on the Routing and Multiple views tutorial  Routers Way back when the world was young (in internet terms a couple of years ago), when single page apps were all the rage, it was noticed that there was a significant drawback to only having one URL index.html; [read] Keywords: ibm xpages ajax application database xml
476


WebSockets comes to XPages!! Awesome – Awesome – Awesome
Tue, May 20th 2014 6:49p   Mark Roden
In this article I will introduce and discuss the OpenNTF WebSockets OSGI plugin by Mark Ambler. The websocket plugin posted to Mark Ambler is based on the http://java-websocket.org/ project. I realize I am not the first person to play with a websocket server on top of a domino database. I know of at least 4 other people who have at least done their own POC for this. But this is the first time I have got my hands on it :) I’m a little excited…… Playing websockets in XPages wit [read] Keywords: agent domino ibm notes rich text sametime xpages application community database integration java javascript network openntf server twitter xml
393


Angular.js in XPages #4 – Using Domino Data
Sun, May 18th 2014 6:36p   Mark Roden
In this article I will demonstrate how to use Angular.js to access Domino Data and display it in place of the hard coded data we used in the previous article. Introduction This article is based off the Angular developer tutorial on XHR and dependency injection . It is essential you go and read that article before continuing. It explains how dependency injection works, why it is used and about Angular services. Modifying the controller In our previous article we used a hard coded json string [read] Keywords: agent domino ibm ldd lotus lotusscript ods xpages ajax application database development java security server
406


Angular.js in XPages #3 – The first app
Sun, May 11th 2014 6:40p   Mark Roden
In this article I will recreate one of the simple Angularjs.org developer tutorials and relate it to how we would build an equivalent XPages application. Create the database As described in the previous article, set up a Domino database with an ODS. Then link your Webstorm to the new ODS structure. Download the Angular code from https://angularjs.org/ it will be an 8M download. Opening the zip file you will see a lot of “angular files”. These are “Dependency files” [read] Keywords: domino ods xpages application applications database development dojo google java server xml




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