361 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Multiple Chrome Incognito browsers share the same data
Sun, Nov 23rd 2014 36
x$ – now a part of XPages Extension Library
Tue, Nov 18th 2014 208
Got non-XPages design elements? You really should use WebContent.
Mon, Nov 17th 2014 234
XPages and Bluemix: How to create a Websockets message without being connected to the application
Sun, Nov 16th 2014 237
One way to make a responsive XPages viewPanel
Tue, Nov 11th 2014 289
Creating an XPages Websockets chat client using Bluemix
Sun, Nov 9th 2014 1124
Finding your localStorage values – Chrome Developer Tools
Thu, Nov 6th 2014 140
Top 10
Creating an XPages Websockets chat client using Bluemix
Sun, Nov 9th 2014 1124
Create your own Watson Q and A example with Bluemix, Webstorm and Jazz Hub
Sun, Oct 12th 2014 507
Integrating the Bluemix Watson Translation service into an XPages application
Sun, Oct 19th 2014 455
Binding jQuery code to an XPages partialRefresh using DOM Mutation events
Wed, Oct 29th 2014 316
One way to make a responsive XPages viewPanel
Tue, Nov 11th 2014 289
Arguably the most dangerous thing you could ever do in XPages – let other people use your eval() in their SSJS
Tue, Jun 18th 2013 273
Oh duh, that is why Node Package Manager (npm) is so cool
Tue, Oct 14th 2014 261
Simple examples of how Google Developer Tools can aid Mobile Development
Thu, Oct 30th 2014 250
XPages and Bluemix: How to create a Websockets message without being connected to the application
Sun, Nov 16th 2014 237
Got non-XPages design elements? You really should use WebContent.
Mon, Nov 17th 2014 234


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



Recent Blog Posts
36


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
208


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
234


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
237


XPages and Bluemix: How to create a Websockets message without being connected to the application
Sun, Nov 16th 2014 6:32p   Mark Roden
In this article I demonstrate how to create a Websocket message to be broadcast, from a website which is not connected to the Websocket directly. This will be achieved by using a http POST request of the message to a node.js server hosted on Bluemix and having that server then emit a Websocket message out to the application. Introduction In the previous article I demonstrated how to create an XPages chat client using a Bluemix hosted node.js server. I was able to do this by porting the node. [read] Keywords: ibm xpages ajax application javascript security server
289


One way to make a responsive XPages viewPanel
Tue, Nov 11th 2014 7:41p   Mark Roden
In this article I will demonstrate a method for hiding columns using CSS and making an XPages view Panel pseudo-responsive. What is Responsive Design? Responsive design is an approach to web page creation that makes use of flexible layouts, flexible images and cascading style sheet media queries. The goal of responsive design is to build web pages that detect the visitor’s screen size and orientation and change the layout accordingly. http://whatis.techtarget.com/definition/responsive-des [read] Keywords: xpages css mobile xml
1124


Creating an XPages Websockets chat client using Bluemix
Sun, Nov 9th 2014 7:53p   Mark Roden
In this article I will demonstrate how I was able to take an example Bluemix, node.js based, websocket chat program and re-purpose it to be used in XPages. Introduction Earlier this year I was very excited to find the Websockets in XPages project on OpenNTF published by Mark Ambler. The concept behind that project is to be able to create a notes document in a queue which is processed and then send out to all users. As much as I promised to help out and use the project, life and a business need [read] Keywords: domino ibm notes xpages ajax application applications css database dojo interface javascript mobile openntf server xml




140


Finding your localStorage values – Chrome Developer Tools
Thu, Nov 6th 2014 8:05p   Mark Roden
Just a quick tip – if you use localStorage and you need to find out what values you have in localStorage you can see them through developer tools easily. F12 to pull up developer tools Resources Local Storage is right there PS A similar feature will be release in the next Firefox (34) developer tools – https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector [read] Keywords: firefox
198


Because developers make mistakes – Webstorm Local History
Wed, Nov 5th 2014 10:24p   Mark Roden
Similar to Eclipse, Webstorm has a local history capability, allowing the developer who realizes they made an idiot mistake an hour ago, to go back to it and save their day. We’ve all been there and while committing to source control is a must for modern development, there are those times in between commits and then those when you are just too lazy to go through the repo looking for it. Local History Local History is always enabled in Webstorm – for the official help check here. U [read] Keywords: development eclipse
154


Conditional style loading in IE10+
Sun, Nov 2nd 2014 8:12p   Mark Roden
I learned this recently when trying to load a conditional stylesheet into an XPage. IE9 worked but IE11 failed on me and I couldn’t see why. It was only a small change so I ended up putting it in the main stylesheet as a media query. Apparently IE10 and above does not understand conditional HTML code like this http://msdn.microsoft.com/en-us/library/ie/hh801214(v=vs.85).aspx So to load a style conditionally in IE11 you can do it like this @media screen and (-ms-high-contrast: a [read] Keywords: css microsoft xml
250


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




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