Dhtml - Notes View

For those of you that always wanted a Expand/Collapse functionality of a view
on a Browser here is how.
First. This code works with IE4.0 and above, (the Netscape version is under
And with Domino 4.6x
Please follow this steps:
Step 1.
Create view and on the first column place the following code column value event:
"[<B>--></DIV>" +
"<SPAN CLASS=\'first\' onClick=\'Expand(" + Categories + ")\'>" + Categories +
"</SPAN><BR>" +
"<DIV CLASS=\'second\' ID=\'" + Categories + "\'

This column must be categorized.
I'm using the Categories field to categorize my documents, use your own field.
and ...
this code goes on the HEADER of the first column:
[</TH></TR></TABLE><!-- <B>]

Step 2.
Create a second column
db := @ReplaceSubstring(@Subset(@DbName; -1); "\\"; "/");
@Text(Date; "D2T1") + " " +
"[<B>--><A HREF = \'javascript:openNews(\"/" + db + "/News/" +
@Text(@DocumentUniqueID) + "?OpenDocument\")\' TARGET=\'_self\'><FONT SIZE=1>"
+ Headline + "</FONT></A><BR><!-- <B>]"

This column build the contect of the collapsible sections, so you can customize
this as you wish, I'm using my own A HREF because my code is on a frame and I'm
using the _self target.

The selection formula for the view it's your choice, on my example I'm
displaying news documents.

Step 3.
Now you have to create another view, in this case I named the view "News", on
this view include just one column sorted and with the following formula for the
column: @Text(@DocumentUniqueID)

and now the finals steps:
Step 4.
Create the $$ViewTemplateDefault form, or the
$$ViewTemplate for .... form, it's up to you.

Add the $HTMLHead field with the following formula:
"<STYLE>" + @NewLine +
".first {font-family:Verdana; font-weight:bold; font-size:10pt; cursor:hand}"
+ @NewLine +
".second {font-family:Verdana; font-weight:normal; font-size:8pt;
padding-left: 10}" + @NewLine +
"</STYLE>" + @NewLine +
"<SCRIPT LANGUAGE=\'JavaScript\'>" + @NewLine +
"<!--" + @NewLine +
"function Expand(secNum) {" + @NewLine +
" if (secNum.style.display == \'none\')" + @NewLine +
" secNum.style.display = \'\'" + @NewLine +
" else" + @NewLine +
" secNum.style.display = \'none\'" + @NewLine +
"}" + @NewLine +

The @NewLine of the formula sends a Line feed to the browser so you have a much
cleaner HTML code.

The javascript function Expand would do the trick for the Expand/Collapse

I hope this could help !!!
Feel free to contact me for any comments.

This was first published in November 2000

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.