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.
Building DHTML views with Internet Explorer (continued)

" class=\"Twisty\"" to the <img HTML right after the style definition (…style=\"cursor:hand\" class=…)

But wait, there's still more. We want to hide everything after this category (all the documents underneath it) initially, when the page loads, so we have to put in a <div> tag. We're also going to need to know which <div> tag to display when the twisty is clicked, so the <div> tag needs its own unique identifier. So, change your column value to:

"<img src=/icons/expand.gif id=Cat" + @Text(@DocNumber) + " style=\"cursor:hand\" class=\"Twisty\">" + Category1 + "
<div id=Cat" + @Text(@DocNumber) + "Top style=\"display:none\">"

The ID is slightly different than the image's ID, which allows us to differentiate between the two. The
is in there so documents will appear below the category. (Remember, we have to generate all the HTML here).

Now, if you were to preview this view in the browser, you may notice something. If you have more than one category, only the first one shows up. That's because we never closed the <div> tag on the first category. So, go back to the first column and at the very start of the formula, put in a "</div>" tag (the value is now "</div><img….". Each category will then close the <div> tag from the previous category.

However, now there's a </div> tag before we even start. This needs a corresponding open <div> tag. To add this, create a $$ViewTemplateDefault form. Add the text "<div>" (without the quotes) in pass-through HTML, and then a $$ViewBody field. That's all the form needs, as the open <div> tag doesn't need any ID or anything since it's just closed right away. Now, if you would preview the view, you'll see all categories.

Adding JavaScript to the view template
However, nothing happens when you click on the twisty. Your cursor changes to a hand, but that's it. That's because we need some JavaScript on the view template. First, we want a function that will be used when a mouse click is captured. I'll give the function and then talk about what's going on:

function doOutline() {
var srcElement = window.event.srcElement;
if (srcElement.className == "Twisty") {
var targetID = srcElement.id + "Top";
var targetElement = document.all(targetID);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
if (srcElement.tagName == "IMG") {
srcElement.src = "/icons/collapse.gif";
}
} else {
targetElement.style.display = "none";
if (srcElement.tagName == "IMG") {
srcElement.src = "/icons/expand.gif";
}
}
}
}


« Previous  ·  1  ·  2  ·  3  ·  4  ·  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 > Tips & Techniques (102 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   A faster way to repair corrupted server files
Home > Internet Technologies > HTML and CSS (15 articles)
   Using a reusable code approach to HTML select option lists
   One reader's opinion on HTML mailing
   Keep lookin' good with Cascading Style Sheets
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 --

Teamstudio Edition 25 has shipped
It's finally here! Now that Teamstudio Edition 25 has shipped, listen to our latest Tool Time audio program to find out what's changed. Updates to all your favorite Teamstudio tools will be discussed.

Plus, you'll get an introduction to Teamstudio Undo (formerly known as Teamstudio Snapper).

Tap here to get started!

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