Search DominoPower's 11,437 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Get twisted and change your twisties (continued)

There are a few more icons there, which are worthwhile to have a look at, like default database icon and column sort icons.

Twist a view
The file-changing trick we talked about above changes all the twisties in one go for the whole server, which is usually not required (or desired). In most cases you'd probably want only to change twistie shapes for specific database views or just for one view.

Since I'm going to use JavaScript for this purpose, what follows is a short introduction.

JavaScript is a scripting language embedded in the HTML document or in separate file (*.js), used to run code on the client-side, within the browser. Limited functionality is available, but it can be very useful for stuff like data validation at client end and making a site interactive (like hovers that change images or text color changes when pointing at links). Basically, you embed little chunks of code in your HTML that the client browser runs when received from the server.

We're going to use JavaScript to get untangled from our twistie twist. Here's a chunk of code:

<SCRIPT LANGUAGE=JavaScript>
var a;
a=2;
if(a>0)
document.write('Shabbir');
</SCRIPT>

First of all, the above code includes the <SCRIPT> HTML tag. According to the HTML spec, if some scripting language like JavaScript, VBScript or JScript is embedded in the document, it must be enclosed by <SCRIPT> and </SCRIPT> tags, with the LANGUAGE attribute specifying which HTML Scripting language is used. In this case, we're using JavaScript.

Now, let's take a look at the few statements in the script:

  • First, we assign the value 2 to the variable a;

  • Next, we check to see if a is greater than 0;

  • Finally, I use the statement document.write('Shabbir'); document is a JavaScript object whose method write is used to display text where the script is placed.

Work with me for a moment, there's more to come. Think of this as just a simple JavaScript example. We'll look at the real routine below.

The best way to solve the twistie problem is that some JavaScript must execute when your view template or the form embedding the view is loaded.

A basic strategy is to load two extra image objects, one for expand and the other for collapse. Then, the document images collection provided in JavaScript is used to check the image URLs to see if it wants an expanded or collapsed image and then replace it. However, while loading images, the browser keeps the source URL undefined (i.e. null). Therefore, a loop is used which keeps executing until all images are loaded. Here's the JavaScript code:

<SCRIPT LANGUAGE=JavaScript>

var i, nullcount, expand, collapse;

expand=new Image(); // creates new image object instance and assign reference
expand.src = '/icons/expview.gif'; //place URL to your image for expand
collapse=new Image();
collapse.src = '/icons/colview.gif'; //place URL to your image for collapse
nullcount=1; // initialize nullcount to non-zero so it enters the while loop.

while(nullcount ) //while loop tests if all the images are loaded by the browser
{
nullcount=0; // Reset nullcount which counts number of images remaining to download.
// document.images is collection of all images (<IMG> tags) on the document
// it has length attribute representing the image count.
for(i=0; i<document.images.length; i++)
{
if(document.images[i].src==null) // src is property storing image url
nullcount++;
else
{
if(document.images[i].src.indexOf('expand.gif')>0) // checks expand
document.images[i].src=expand.src;
else if(document.images[i].src.indexOf('collapse.gif')>0) //checks collapse
document.images[i].src=collapse.src;
}
}
}

</SCRIPT>


« Previous  ·  1  ·  2  ·  3  ·  Next »
Other articles you might like
Home > Internet Technologies > JavaScript (13 articles)
   Sorting your Domino views with JavaScript
   Give your Domino views life with DHTML
   Using dynamically generated HTML to thwart spam email address harvesting
Home > Lotus Technologies > Application Development (48 articles)
   An application for scanning physical mail and distributing it virtually
   How hide-whens in Rich Text can ruin your whole day (and what to do about it)
   Little known traps about Lotus Notes fields
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
Adding Quick Highlighter support to IBM Lotus Notes Domino Wiki, Weblog, or Webpage
Remember Young Admins...there are 2 files
WebSphere Portal 6.1.0.2 and Lotus Domino 8.5
The CKEditor - with Domino
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
-- Advertisement --

Integrate your Notes Applications with Microsoft Office and Symphony
Integra for Notes Integrates Microsoft Office and/or IBM Lotus Symphony
Requires NO change to the design of the appliation or Installations of DLL's and EXE's
  • Integra is a ready to use solution, enhance static reports with Excel data analysis, pivot tables, macros
  • User friendly aproach, using a point and click access to features
  • Reports from any Lotus Notes databases
  • Runs reports through a Notes client, web browser and scheduled basis
  • Allows use of LotusScript for advanced data manipulation
  • Enables self service reporting capabilities to end-users


Learn more at www.integra4notes.com.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login